summamail Posted October 4, 2007 Share Posted October 4, 2007 Hi, I am learning PHP, I just got apache server got up and running in my AMD64 RHEL4 machine. I am wondering why I should create my PHP file under /var/www/html/ ?. For that I have to be a super user (root). I want to create pages in user account, that can be viewed by browser. Can any one guide me how to make browser to read my PHP file kept under my user account?. Thanks Summa Quote Link to comment https://forums.phpfreaks.com/topic/71774-php-file-location/ Share on other sites More sharing options...
d.shankar Posted October 4, 2007 Share Posted October 4, 2007 Inorder to deploy your code you have to copy your apps to the www folder only. Quote Link to comment https://forums.phpfreaks.com/topic/71774-php-file-location/#findComment-361497 Share on other sites More sharing options...
solarisuser Posted October 4, 2007 Share Posted October 4, 2007 Look at Apache configuration on "UserDir" Quote Link to comment https://forums.phpfreaks.com/topic/71774-php-file-location/#findComment-361520 Share on other sites More sharing options...
trq Posted October 4, 2007 Share Posted October 4, 2007 This is more a Linux question than that of php. You need to make a group which is allowed to create files within /var/www/html. As an example I will use the group www. As root, make /var/www/html be owned by root:www $ groupadd www $ chown -R root:www Next you need to add your username to this same group. Again, as root issue... $ usermod -G www yourusername Note: If you allready are the member of suplimentary groups you will need to put them is a comma seperated string after the -G option as well. eg; $ usermod -G wheel,cdrom,audio,www yourusername Once this is all done you will be able to write to the /var/www/html directory when logged in to yourusername account. Quote Link to comment https://forums.phpfreaks.com/topic/71774-php-file-location/#findComment-361688 Share on other sites More sharing options...
neylitalo Posted October 4, 2007 Share Posted October 4, 2007 This is more a Linux question than that of php. You need to make a group which is allowed to create files within /var/www/html. As an example I will use the group www. As root, make /var/www/html be owned by root:www $ groupadd www $ chown -R root:www Next you need to add your username to this same group. Again, as root issue... $ usermod -G www yourusername Note: If you allready are the member of suplimentary groups you will need to put them is a comma seperated string after the -G option as well. eg; $ usermod -G wheel,cdrom,audio,www yourusername # gpasswd -a username groupname I always hated typing out all of the group names when I had to add a user to a group. And to publish files in your home directory, you can create a directory ~/public_html, define USERDIR (-D USERDIR) in the startup options in your apache conf file (/etc/conf.d/httpd, maybe). Just make sure that directory is readable by the apache user. Quote Link to comment https://forums.phpfreaks.com/topic/71774-php-file-location/#findComment-361814 Share on other sites More sharing options...
trq Posted October 4, 2007 Share Posted October 4, 2007 I always hated typing out all of the group names when I had to add a user to a group. Me too! And I always forget about gpasswd. I swear it not mentioned within the SEE ALSO section of usermod either. Thanks. Quote Link to comment https://forums.phpfreaks.com/topic/71774-php-file-location/#findComment-361839 Share on other sites More sharing options...
winicius Posted October 6, 2007 Share Posted October 6, 2007 You could create a symbolic link in /var/www/html/ that points to the directory in which you will have your web files. In other words, create a symbolic link using the command "ln" that points to your directory /home/user_name/web. Please take note that the directory "web" is where you will keep all your web files. It is as simple as that. Quote Link to comment https://forums.phpfreaks.com/topic/71774-php-file-location/#findComment-363506 Share on other sites More sharing options...
trq Posted October 7, 2007 Share Posted October 7, 2007 It is as simple as that. You still need to adjust the permissions of the directory your symlink points to or you still wont be able to write to it. Quote Link to comment https://forums.phpfreaks.com/topic/71774-php-file-location/#findComment-364035 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.