I’m currently developing a website that will make use of PHP scripts and I’d like to be able to test them on my local machine before pushing them out to the server, however I’m having problems doing that. Typically, I keep all my development projects in a folder call ~/Projects/projectName, but that doesn’t seem to be an option with web scripting. I’ve read that I need to install Apache (which I’ve done) and PHP (also done) and then move my project into the web server’s root directory located at /var/www (I’m on Linux) which I haven’t done since that’s a system directory and I won’t be able to edit my files in there.
I’ve looked around and there doesn’t seem to be any way of invoking a PHP script from a webpage anywhere but this one directory. I’ve tried soft-linking my ~/Projects/projectName directory into /var/www, but since it’s a subdirectory of the web server’s root, that’s causing permission errors when I try to access the file at /var/www/projectName/index.html.
Is there any way to house my files in my Projects folder and still be able to run them locally without too much hassle?
You need to create a new Apache Virtual Host configuration to point to your
~/Projects/projectNamefolder as it’s webroot.Here is a very basic configuration for that type of setup
But it also sounds like you might not have root or sudo access since you can’t write to
/var/wwwas well… Adjusting your Apache config requires similar privileges.