It appears i am unable to create files. After i set permissions to 777 Around the folder i'm trying to produce a folder in then your script works fine. When the folder is placed to 755, it fails. I don't know much about linux, however i am suppose to find these items out. I've spent a few hrs trying stuff. Does anybody understand how to allow it to be to ensure that apache has sufficient permissions.
Yes, it is really a permissions and apache problem, i simply don't know how you can fix this. I've edited the httpd.conf file, but i truly do not understand what i'm doing... Any help? (I saved backup.)
Please stop recommending to make use of 777. You are making your file writeable by everybody, which virtually means you lose all security the permission system was created for. Should you suggest this, consider the effects it might dress in a poorly set up webserver: it might become increasingly simple to "hack" the web site, by overwriting the files. So, don't.
Michael: there is a perfectly viable reason your script can't produce the directory, the consumer running PHP (that could be not the same as Apache) simply does not plenty of permissions to do this. Rather than altering the permissions, I believe you need to solve the actual problem, meaning your files possess the wrong owner, or Apache or PHP is running underneath the wrong user.
Now, it appears as if you have your personal server installed. You are able to pick which user is running PHP by managing a simple script that calls the 'whoami' program set up in most linuxes:
<?php echo `whoami`;
If all is appropriate, you need to begin to see the username PHP is running under. Based on your OS, this can be 'www-data', 'nobody', 'http', or any variation. If your site is the only real website running, this really is simple to change by altering the consumer Apache runs under. For those who have Debian, like I am inclined to, you are able to edit the file /etc/apache2/envvars (as root), and alter the worthiness for APACHE_RUN_USER. Based on your OS, this variable may be occur another configuration file, if you aren't able to find it in /etc/apache2/envvars, try to find the variable declaration by utilizing:
$ grep -R "APACHE_RUN_USER=" .
In the directory all apache-config files have been in.
If you are only some of the one around the server, you might like to consider creating user makes up about every website, and taking advantage of something similar to Apache2-MPM-ITK to alter the RUN_USER based on which website is known as. Also, make certain the user the PHP process is running under has the files, and also the sites. You are able to accomplish this by utilizing chown:
% chown theuser:theuser -R /var/www/website/
If PHP is running with it's own user, and has the files and sites it must write in, the permission 700 could be enough. I am inclined to use 750 for many files myself though, when i have multiple customers for the reason that group, plus they might have reading through permissions. So, you are able to alter the permissions:
% chmod 0750 -R /var/www/website/
That needs to be it. Should you getting issues, tell us, and do not ever occupy any suggest that basically informs you: if security is disturbing you, take away the security.
The php user (www-data, php, apache, whatever it might be) will need write permissions towards the 755 dir. I'm presuming that it's not part of the audience from the creator from the folder otherwise it might have the ability to email it. Either add the php user towards the group or alter the permissions around the folder to 777. If neither is definitely an option, you'll be able to make use of the PECL SSH2 extension to sign in having a user that's within the group (or who owns the file) and make the files rather.
On ubuntu you edit /etc/apache2/envvars as Berry recommended.
Whenever you alter the Apache user, watch out for unintentional effects. One of these may be the PHP periods that might be saved in /var/lib/php5. You may want to alter the possession of this folder too.