1

Which directory should I choose for my PHP projects? Should I use ~/public_html in my home directory or should I choose /var/www and change the owner to have write permissions? What would you recommend?

1
  • 4
    I believe /var/www is the default directory. Also if you're going to use /var/www make sure ownership is given to www-data Commented Aug 13, 2012 at 10:24

4 Answers 4

1

I prefer doing development in my home directory since I think that is where user files should be placed. But this is a personal choice, do what you think is best and/or easiest to configure. It should not matter that much.

Sign up to request clarification or add additional context in comments.

Comments

1

I prefer using something like ~/development/php in my home dir, and then I either add symlink into /var/www or declare a virtual host in Apache pointing to my directory.

3 Comments

How do you declare a virtual host?
This is my same configuration (~/src/projectname and then a symlink in /var/www/ or /srv/www/)
Depending of your setup, it configured in httpd.conf or vhosts.conf or a similar file. The syntax is explained in Apache docs.
0

I believe /var/www is the default directory. Also if you're going to use /var/www make sure ownership is given to www-data

Comments

0

It's good idea to put as little as possible of your source code in web-accessible places ( /var/www ) so that if your machine is misconfigured your source isn't public.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.