Quantcast
Channel: Active questions tagged ubuntu - Stack Overflow
Viewing all articles
Browse latest Browse all 7169

Where do I put my PHP files on my EC2 Ubuntu server?

$
0
0

I've been working on my first full stack web dev project for a little while now. To summarize it, I have a small Vite app with a form that can take in data from a user and then use a php file to submit that data to a mySQL server. It can also read from the mySQL server and place its data in a table using another php file.

I'm very new to PHP, but this all works on a local level. I am able to run the preview version of my app on localhost and connect to a database on XAMPP. For XAMPP, I know to put my php files in the htdocs folder that is part of the application. However, I do not know where these files should go on the EC2 Ubuntu server I have running, using Caddy. The application runs normally there, and I have mysql with the same database there, but I don't know how to "connect" my typescript based Vite app with the mySQL database using those files I have written. Thus, no data appears in the table, nor can I submit to it. I get a network error.

Basically, is there an equivalent to the XAMPP 'htdocs' folder for an EC2 ubuntu server that a Vite app will understand? I would place them wherever "localhost/" is, but once my application is compiled, I don't know where that is.

(You might ask why I am using PHP which I am unfamiliar with rather than a typescript backend, and it is because later on I want to be able to generate new html code, which to my understanding typescript cannot do)

So far, I have tried putting them in a few places: the public folder, the src folder, and root folder. I have also seen other posts suggesting places like /var/www/html, but that doesn't seem to apply to me. I don't even see that directory or /var/www. I am running my app using Caddy, not Apache.

No matter which place I try, I am getting this network error. If you think it may not just be a matter of file location but a security issue, feel free to ask me addition questions! Since this is a new instance and is still being set up with https, it may be a CORS problem as well. I'm partially asking this question because I really just don't know how php works and would like clarification I haven't been able to find elsewhere.


Viewing all articles
Browse latest Browse all 7169

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>