[PHP] Question about directory permissions
I understand dir perms pretty well; but, have a question I can't readily find the answer to. Under a Linux system, scripts can't write, copy, etc. to other dirs unless the perms are set for writable for the script e.g., nobody. But, is there a way a script can write or copy within its own dir? Thanks... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Question about directory permissions
Sure. The script runs with the permissions of whoever is running it. In general, a PHP script that's a web page in linux will run by a user called something like apache, apache2, www-user, or something similar. If you give that user permissions -- either directly or through their group, often of the same name -- to write to the directory in question, then the script will be able to write to it. For instance: on my Ubuntu 10.04 server, I want my script DW3 to be able to write to /var/www/DW3/logs. I leave ownership of everything else as it was, and do the following: $ cd /var/www/DW3 $ chgrp www-data ./logs $ chmod 770 ./logs Now members of the group www-data (at the moment only apache) can write to the directory, as can the owner, but no one else can. In reality, I could probably have set that to 660, but I don't much care about the slight added risk of using 770 in this case. (If you're confused by the numbers I used, check here: http://www.yolinux.com/TUTORIALS/LinuxTutorialManagingGroups.html) I hope that helps! -Andy On Mon, Mar 21, 2011 at 1:58 PM, Al wrote: > I understand dir perms pretty well; but, have a question I can't readily > find the answer to. > > Under a Linux system, scripts can't write, copy, etc. to other dirs unless > the perms are set for writable for the script e.g., nobody. > > But, is there a way a script can write or copy within its own dir? > > Thanks... > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Question about directory permissions
Al wrote: > I understand dir perms pretty well; but, have a question I can't readily > find > the answer to. > > Under a Linux system, scripts can't write, copy, etc. to other dirs unless > the > perms are set for writable for the script e.g., nobody. > > But, is there a way a script can write or copy within its own dir? > Not unless it has permission to do so. Most likely, however, it can write to the temp space such as /tmp or /var/tmp. --Curtis
[PHP] SSL issues
Hi all, is anyone else experiencing SSL connectivity issues with PHP 5.3(.5|6)? PHP 5.2.17 compiled identically on the same system with the same config file connects to remote SSL-enabled host just fine, whereas PHP 5.3 (only tried .5 and .6) does not. Error message: Warning: stream_socket_client(): SSL operation failed with code 1. OpenSSL Error messages: error:140773F2:SSL routines:SSL23_GET_SERVER_HELLO:sslv3 alert unexpected message Warning: stream_socket_client(): Failed to enable crypto Any ideas why this is happening? Thanks, b. PS: With all the best efforts towards ditching PHP 5.2 this is a real showstopper. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php