Re: [PHP] Permission Denied - Help Requested - Solved
At 12:07 AM 3/30/2011, Adam Richardson wrote: On Tue, Mar 29, 2011 at 8:21 PM, Ethan Rosenberg eth...@earthlink.netwrote: At 05:33 PM 3/29/2011, Adam Richardson wrote: Thanks. What do you see if you run this? Can't open or create file! Ethan OK, If you're running PHP as an Apache module, by default it won't have permissions to write to the directory (this is by design to avoid security issues.) You can do something like the following: 1. Create a directory for writing files outside of your public directory (let's call it uploads.) 2. Change the group associated with the directory to Apache: sudo chgrp -R www-data /home/username/path/to/uploads 3. Change the permissions on the directory so the group has write permissions: sudo chmod -R 2775 /home/username/path/to/uploads 4. Then try the script again. See if that works. Adam -- Nephtali: A simple, flexible, fast, and security-focused PHP framework http://nephtaliproject.com Thanks - The directory is output_files, which is a subdirectory of /var/www I'm getting a message invalid owner on the command chown Apache output_files. Also with the -R option, and with apache as the owner, also with the chgrp. All these commands are run as root.. Help and advice please. Ethan Hi Ethan, I might be missing something. Did you set up the user Apache? On a standard install for Debian (using apt-get), apache is usually set up as the user/group www-data: http://wiki.debian.org/Apache http://wiki.debian.org/ApacheThe root user typically owns the /var/www directory. I usually set up virtual hosts within one of the other accounts and then change the group on a directory outside of the public directory specifically set aside for uploads and run the commands I sent. However, in the case of your example, I believe you can just run the 2 commands I sent on the /var/www/output_files directory and you should be able to write the files. sudo chgrp -R www-data /var/www/output_files sudo chmod -R 2775 /var/www/output_files Hope this helps, and sorry if I misunderstood something in your configuration or troubleshooting. Adam -- Nephtali: A simple, flexible, fast, and security-focused PHP framework http://nephtaliproject.com Adam - Thanks. Works beautifully. Ethan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Permission Denied - Help Requested
On Mon, Mar 28, 2011 at 11:43 PM, Ethan Rosenberg eth...@earthlink.netwrote: At 11:14 PM 3/28/2011, Adam Richardson wrote: On Mon, Mar 28, 2011 at 11:03 PM, Ethan Rosenberg mailto: eth...@earthlink.neteth...@earthlink.net wrote: At 01:32 AM 3/28/2011, Hans Åhlin wrote: Do you have SELinux installed? 2011/3/28 Ethan Rosenberg mailto:eth...@earthlink.net eth...@earthlink.net: Dear List - Thanks for all your help in the past.  Here is another one... I am getting a Permission Denied message when I try to run a PHP script.  I just changed the mode on the directory and the files to 777.  This problem arose when I changed the permissions.  I thought I was solving a problem, because I could not open a file for writing.  I was not receiving error messages, but no file was created. Help and advice, please. Ethan Rosenberg **  Hans Åhlin   Tel: +46761488019   icq: 275232967   http://www.kronan-net.com/http://www.kronan-net.com/   irc://http://irc.freenode.net:6667irc.freenode.net:6667 - TheCoin ** Hans - Sorry, I did not include my signature, which includes all the requested information. Here it is Ethan == MySQL 5.1 PHP 5.3.3-6 Linux [Debian (sid)] The problem persists. I cannot write to a file from PHP. Any more suggestions? Thanks. Ethan Hi Ethan, Are you using suPHP or suExec? I believe the server chokes on 777 permissions in those cases. Have you checked the permissions in the command line (sorry for the basic question, but just making sure I know what you've already done?) Also, can we see some of the code you're using to handle the file processing? Thanks, Adam -- Nephtali: A simple, flexible, fast, and security-focused PHP framework http://nephtaliproject.comhttp://nephtaliproject.com + Adam - Thanks. 1] Pardon my ignorance but I do not understand this - Are you using suPHP or suExec? suPHP and suExec are two modules that allow PHP to run with the permissions of the user, making it easy to write files to disk. However, suPHP (and I believe suExec, but I can't remember for sure) does not like 777 permissions. 2] I changed the permissions to 755 and the Permission Denied message went away. Check! 3] Have you checked the permissions in the command line? Yes Check! 4] Here are some code snippets: $fptr1 = fopen(chessboard, r+); //this works $fptr2 = fopen('chessboard', 'w'); //this deletes the file, as it should for($i = 0; $i 8; $i++) { for ($j = 0; $j 8; $j++) fprinf($fptr2, %s , $results[$i][$j]); fprinf($fptr2, \n); } //this never writes, so I am left with an empty file Can you try a simplified form that checks for success along the way? How about something like the code below to see how far it gets (I haven't tested, but it should be close): ?php // let's make sure you see the E_WARNING errors if present for file functions error_reporting(-1); // set var for later $cost = 120.89; if (!($fp = fopen(test.txt, 'w'))) { echo Can't open or create file!; } else if (!($len = fprintf($fp, In the year 3000, a Coke will cost %01.2f, with tax., $cost))) { echo Can't write to file!; } else if (!(fclose($fp))) { echo Can't properly close file!; } ? What do you see if you run this? Adam -- Nephtali: A simple, flexible, fast, and security-focused PHP framework http://nephtaliproject.com
Re: [PHP] Permission Denied - Help Requested
At 01:40 PM 3/29/2011, Adam Richardson wrote: On Mon, Mar 28, 2011 at 11:43 PM, Ethan Rosenberg eth...@earthlink.netwrote: At 11:14 PM 3/28/2011, Adam Richardson wrote: On Mon, Mar 28, 2011 at 11:03 PM, Ethan Rosenberg mailto: eth...@earthlink.neteth...@earthlink.net wrote: At 01:32 AM 3/28/2011, Hans à hlin wrote: Do you have SELinux installed? 2011/3/28 Ethan Rosenberg mailto:eth...@earthlink.net eth...@earthlink.net: Dear List - Thanks for all your help in the past.  Here is another one... I am getting a Permission Denied message when I try to run a PHP script.  I just changed the mode on the directory and the files to 777.  This problem arose when I changed the permissions.  I thought I was solving a problem, because I could not open a file for writing.  I was not receiving error messages, but no file was created. Help and advice, please. Ethan Rosenberg **  Hans à hlin   Tel: +46761488019   icq: 275232967   http://www.kronan-net.com/http://www.kronan-net.com/   irc://http://irc.freenode.net:6667irc.freenode.net:6667 - TheCoin ** Hans - Sorry, I did not include my signature, which includes all the requested information. Here it is Ethan == MySQL 5.1 PHP 5.3.3-6 Linux [Debian (sid)] The problem persists. I cannot write to a file from PHP. Any more suggestions? Thanks. Ethan Hi Ethan, Are you using suPHP or suExec? I believe the server chokes on 777 permissions in those cases. Have you checked the permissions in the command line (sorry for the basic question, but just making sure I know what you've already done?) Also, can we see some of the code you're using to handle the file processing? Thanks, Adam -- Nephtali: A simple, flexible, fast, and security-focused PHP framework http://nephtaliproject.comhttp://nephtaliproject.com + Adam - Thanks. 1] Pardon my ignorance but I do not understand this - Are you using suPHP or suExec? suPHP and suExec are two modules that allow PHP to run with the permissions of the user, making it easy to write files to disk. However, suPHP (and I believe suExec, but I can't remember for sure) does not like 777 permissions. 2] I changed the permissions to 755 and the Permission Denied message went away. Check! 3] Have you checked the permissions in the command line? Yes Check! 4] Here are some code snippets: $fptr1 = fopen(chessboard, r+); //this works $fptr2 = fopen('chessboard', 'w'); //this deletes the file, as it should for($i = 0; $i 8; $i++) { for ($j = 0; $j 8; $j++) fprinf($fptr2, %s , $results[$i][$j]); fprinf($fptr2, \n); } //this never writes, so I am left with an empty file Can you try a simplified form that checks for success along the way? How about something like the code below to see how far it gets (I haven't tested, but it should be close): ?php // let's make sure you see the E_WARNING errors if present for file functions error_reporting(-1); // set var for later $cost = 120.89; if (!($fp = fopen(test.txt, 'w'))) { echo Can't open or create file!; } else if (!($len = fprintf($fp, In the year 3000, a Coke will cost %01.2f, with tax., $cost))) { echo Can't write to file!; } else if (!(fclose($fp))) { echo Can't properly close file!; } ? What do you see if you run this? Adam -- Nephtali: A simple, flexible, fast, and security-focused PHP framework http://nephtaliproject.com +++ Thanks. What do you see if you run this? Can't open or create file! Ethan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Permission Denied - Help Requested
On 3/29/2011 3:06 PM, Ethan Rosenberg wrote: At 01:40 PM 3/29/2011, Adam Richardson wrote: On Mon, Mar 28, 2011 at 11:43 PM, Ethan Rosenberg eth...@earthlink.netwrote: At 11:14 PM 3/28/2011, Adam Richardson wrote: On Mon, Mar 28, 2011 at 11:03 PM, Ethan Rosenberg mailto: eth...@earthlink.neteth...@earthlink.net wrote: At 01:32 AM 3/28/2011, Hans �hlin wrote: Do you have SELinux installed? 2011/3/28 Ethan Rosenberg mailto:eth...@earthlink.net eth...@earthlink.net: Dear List - Thanks for all your help in the past.  Here is another one... I am getting a Permission Denied message when I try to run a PHP script.  I just changed the mode on the directory and the files to 777.  This problem arose when I changed the permissions.  I thought I was solving a problem, because I could not open a file for writing.  I was not receiving error messages, but no file was created. Help and advice, please. Ethan Rosenberg **  Hans �hlin   Tel: +46761488019   icq: 275232967   http://www.kronan-net.com/http://www.kronan-net.com/   irc://http://irc.freenode.net:6667irc.freenode.net:6667 - TheCoin ** Hans - Sorry, I did not include my signature, which includes all the requested information. Here it is Ethan == MySQL 5.1 PHP 5.3.3-6 Linux [Debian (sid)] The problem persists. I cannot write to a file from PHP. Any more suggestions? Thanks. Ethan Hi Ethan, Are you using suPHP or suExec? I believe the server chokes on 777 permissions in those cases. Have you checked the permissions in the command line (sorry for the basic question, but just making sure I know what you've already done?) Also, can we see some of the code you're using to handle the file processing? Thanks, Adam -- Nephtali: A simple, flexible, fast, and security-focused PHP framework http://nephtaliproject.comhttp://nephtaliproject.com + Adam - Thanks. 1] Pardon my ignorance but I do not understand this - Are you using suPHP or suExec? suPHP and suExec are two modules that allow PHP to run with the permissions of the user, making it easy to write files to disk. However, suPHP (and I believe suExec, but I can't remember for sure) does not like 777 permissions. 2] I changed the permissions to 755 and the Permission Denied message went away. Check! 3] Have you checked the permissions in the command line? Yes Check! 4] Here are some code snippets: $fptr1 = fopen(chessboard, r+); //this works $fptr2 = fopen('chessboard', 'w'); //this deletes the file, as it should for($i = 0; $i 8; $i++) { for ($j = 0; $j 8; $j++) fprinf($fptr2, %s , $results[$i][$j]); fprinf($fptr2, \n); } //this never writes, so I am left with an empty file Can you try a simplified form that checks for success along the way? How about something like the code below to see how far it gets (I haven't tested, but it should be close): ?php // let's make sure you see the E_WARNING errors if present for file functions error_reporting(-1); // set var for later $cost = 120.89; if (!($fp = fopen(test.txt, 'w'))) { echo Can't open or create file!; } else if (!($len = fprintf($fp, In the year 3000, a Coke will cost %01.2f, with tax., $cost))) { echo Can't write to file!; } else if (!(fclose($fp))) { echo Can't properly close file!; } ? What do you see if you run this? Adam -- Nephtali: A simple, flexible, fast, and security-focused PHP framework http://nephtaliproject.com +++ Thanks. What do you see if you run this? Can't open or create file! Ethan Run this. Make certain this script and test.txt are in the same dir. If not, use full path to your file. clearstatcache(); $array= stat(test.txt); print_r($array);//This will tell you what's going on. Incidentally, consider using file_get_contents() and file_put_contents() Much easier to use and faster. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Permission Denied - Help Requested
At 03:49 PM 3/29/2011, Al wrote: On 3/29/2011 3:06 PM, Ethan Rosenberg wrote: At 01:40 PM 3/29/2011, Adam Richardson wrote: On Mon, Mar 28, 2011 at 11:43 PM, Ethan Rosenberg eth...@earthlink.netwrote: At 11:14 PM 3/28/2011, Adam Richardson wrote: On Mon, Mar 28, 2011 at 11:03 PM, Ethan Rosenberg mailto: eth...@earthlink.neteth...@earthlink.net wrote: At 01:32 AM 3/28/2011, Hans Ã�hlin wrote: Do you have SELinux installed? 2011/3/28 Ethan Rosenberg mailto:eth...@earthlink.net eth...@earthlink.net: Dear List - Thanks for all your help in the past. à Here is another one... I am getting a Permission Denied message when I try to run a PHP script. à I just changed the mode on the directory and the files to 777. à This problem arose when I changed the permissions. à I thought I was solving a problem, because I could not open a file for writing. à I was not receiving error messages, but no file was created. Help and advice, please. Ethan Rosenberg ** à Hans Ã�hlin à à Tel: +46761488019 à à icq: 275232967 à à http://www.kronan-net.com/http://www.kronan-net.com/ à à irc://http://irc.freenode.net:6667irc.freenode.net:6667 - TheCoin ** Hans - Sorry, I did not include my signature, which includes all the requested information. Here it is Ethan == MySQL 5.1 PHP 5.3.3-6 Linux [Debian (sid)] The problem persists. I cannot write to a file from PHP. Any more suggestions? Thanks. Ethan Hi Ethan, Are you using suPHP or suExec? I believe the server chokes on 777 permissions in those cases. Have you checked the permissions in the command line (sorry for the basic question, but just making sure I know what you've already done?) Also, can we see some of the code you're using to handle the file processing? Thanks, Adam -- Nephtali: A simple, flexible, fast, and security-focused PHP framework http://nephtaliproject.comhttp://nephtaliproject.com + Adam - Thanks. 1] Pardon my ignorance but I do not understand this - Are you using suPHP or suExec? suPHP and suExec are two modules that allow PHP to run with the permissions of the user, making it easy to write files to disk. However, suPHP (and I believe suExec, but I can't remember for sure) does not like 777 permissions. 2] I changed the permissions to 755 and the Permission Denied message went away. Check! 3] Have you checked the permissions in the command line? Yes Check! 4] Here are some code snippets: $fptr1 = fopen(chessboard, r+); //this works $fptr2 = fopen('chessboard', 'w'); //this deletes the file, as it should for($i = 0; $i 8; $i++) { for ($j = 0; $j 8; $j++) fprinf($fptr2, %s , $results[$i][$j]); fprinf($fptr2, \n); } //this never writes, so I am left with an empty file Can you try a simplified form that checks for success along the way? How about something like the code below to see how far it gets (I haven't tested, but it should be close): ?php // let's make sure you see the E_WARNING errors if present for file functions error_reporting(-1); // set var for later $cost = 120.89; if (!($fp = fopen(test.txt, 'w'))) { echo Can't open or create file!; } else if (!($len = fprintf($fp, In the year 3000, a Coke will cost %01.2f, with tax., $cost))) { echo Can't write to file!; } else if (!(fclose($fp))) { echo Can't properly close file!; } ? What do you see if you run this? Adam -- Nephtali: A simple, flexible, fast, and security-focused PHP framework http://nephtaliproject.com +++ Thanks. What do you see if you run this? Can't open or create file! Ethan Run this. Make certain this script and test.txt are in the same dir. If not, use full path to your file. clearstatcache(); $array= stat(test.txt); print_r($array);//This will tell you what's going on. Incidentally, consider using file_get_contents() and file_put_contents() Much easier to use and faster. + Al - Thanks. Here is what I ran and the output. I do not know enough PHP to interpret the output. !DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Transitional//EN http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtdhttp://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd; html body ?php error_reporting(1); clearstatcache(); $array= stat(test.txt); print_r($array);//This will tell you what's going on. // Output /* Array ( [0] = 2050 [1] = 876877 [2] = 33188 [3] = 1 [4] = 1001 [5] = 1001 [6] = 0 [7] = 30 [8] = 1301430589 [9] = 1301430589 [10] = 1301430589 [11] = 4096 [12] = 8 [dev] = 2050 [ino] = 876877 [mode] = 33188 [nlink] = 1 [uid] = 1001 [gid] = 1001 [rdev] = 0 [size] = 30 [atime] = 1301430589 [mtime] = 1301430589 [ctime] = 1301430589 [blksize] = 4096 [blocks] = 8 ) */ ? /body /html Help and advice, please. Ethan -- PHP General Mailing List (http://www.php.net/) To unsubscribe,
RE: [PHP] Permission Denied - Help Requested
Have you checked ownership? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Permission Denied - Help Requested
Thanks. What do you see if you run this? Can't open or create file! Ethan OK, If you're running PHP as an Apache module, by default it won't have permissions to write to the directory (this is by design to avoid security issues.) You can do something like the following: 1. Create a directory for writing files outside of your public directory (let's call it uploads.) 2. Change the group associated with the directory to Apache: sudo chgrp -R www-data /home/username/path/to/uploads 3. Change the permissions on the directory so the group has write permissions: sudo chmod -R 2775 /home/username/path/to/uploads 4. Then try the script again. See if that works. Adam -- Nephtali: A simple, flexible, fast, and security-focused PHP framework http://nephtaliproject.com
Re: [PHP] Permission Denied - Help Requested
At 05:33 PM 3/29/2011, Adam Richardson wrote: Thanks. What do you see if you run this? Can't open or create file! Ethan OK, If you're running PHP as an Apache module, by default it won't have permissions to write to the directory (this is by design to avoid security issues.) You can do something like the following: 1. Create a directory for writing files outside of your public directory (let's call it uploads.) 2. Change the group associated with the directory to Apache: sudo chgrp -R www-data /home/username/path/to/uploads 3. Change the permissions on the directory so the group has write permissions: sudo chmod -R 2775 /home/username/path/to/uploads 4. Then try the script again. See if that works. Adam -- Nephtali: A simple, flexible, fast, and security-focused PHP framework http://nephtaliproject.com Thanks - The directory is output_files, which is a subdirectory of /var/www I'm getting a message invalid owner on the command chown Apache output_files. Also with the -R option, and with apache as the owner, also with the chgrp. All these commands are run as root.. Help and advice please. Ethan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Permission Denied - Help Requested
On Tue, Mar 29, 2011 at 8:21 PM, Ethan Rosenberg eth...@earthlink.netwrote: At 05:33 PM 3/29/2011, Adam Richardson wrote: Thanks. What do you see if you run this? Can't open or create file! Ethan OK, If you're running PHP as an Apache module, by default it won't have permissions to write to the directory (this is by design to avoid security issues.) You can do something like the following: 1. Create a directory for writing files outside of your public directory (let's call it uploads.) 2. Change the group associated with the directory to Apache: sudo chgrp -R www-data /home/username/path/to/uploads 3. Change the permissions on the directory so the group has write permissions: sudo chmod -R 2775 /home/username/path/to/uploads 4. Then try the script again. See if that works. Adam -- Nephtali: A simple, flexible, fast, and security-focused PHP framework http://nephtaliproject.com Thanks - The directory is output_files, which is a subdirectory of /var/www I'm getting a message invalid owner on the command chown Apache output_files. Also with the -R option, and with apache as the owner, also with the chgrp. All these commands are run as root.. Help and advice please. Ethan Hi Ethan, I might be missing something. Did you set up the user Apache? On a standard install for Debian (using apt-get), apache is usually set up as the user/group www-data: http://wiki.debian.org/Apache http://wiki.debian.org/ApacheThe root user typically owns the /var/www directory. I usually set up virtual hosts within one of the other accounts and then change the group on a directory outside of the public directory specifically set aside for uploads and run the commands I sent. However, in the case of your example, I believe you can just run the 2 commands I sent on the /var/www/output_files directory and you should be able to write the files. sudo chgrp -R www-data /var/www/output_files sudo chmod -R 2775 /var/www/output_files Hope this helps, and sorry if I misunderstood something in your configuration or troubleshooting. Adam -- Nephtali: A simple, flexible, fast, and security-focused PHP framework http://nephtaliproject.com
Re: [PHP] Permission Denied
At 01:32 AM 3/28/2011, Hans à hlin wrote: Do you have SELinux installed? 2011/3/28 Ethan Rosenberg eth...@earthlink.net: Dear List - Thanks for all your help in the past.  Here is another one... I am getting a Permission Denied message when I try to run a PHP script.  I just changed the mode on the directory and the files to 777.  This problem arose when I changed the permissions.  I thought I was solving a problem, because I could not open a file for writing.  I was not receiving error messages, but no file was created. Help and advice, please. Ethan Rosenberg -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- **  Hans à hlin   Tel: +46761488019   icq: 275232967   http://www.kronan-net.com/   irc://irc.freenode.net:6667 - TheCoin ** Hans - Sorry, I did not include my signature, which includes all the requested information. Here it is Ethan == MySQL 5.1 PHP 5.3.3-6 Linux [Debian (sid)] -- 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] Permission Denied - Help Requested
At 01:32 AM 3/28/2011, Hans à hlin wrote: Do you have SELinux installed? 2011/3/28 Ethan Rosenberg eth...@earthlink.net: Dear List - Thanks for all your help in the past.  Here is another one... I am getting a Permission Denied message when I try to run a PHP script.  I just changed the mode on the directory and the files to 777.  This problem arose when I changed the permissions.  I thought I was solving a problem, because I could not open a file for writing.  I was not receiving error messages, but no file was created. Help and advice, please. Ethan Rosenberg **  Hans à hlin   Tel: +46761488019   icq: 275232967   http://www.kronan-net.com/   irc://irc.freenode.net:6667 - TheCoin ** Hans - Sorry, I did not include my signature, which includes all the requested information. Here it is Ethan == MySQL 5.1 PHP 5.3.3-6 Linux [Debian (sid)] The problem persists. I cannot write to a file from PHP. Any more suggestions? Thanks. Ethan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php MySQL 5.1 PHP 5.3.3-6 Linux [Debian (sid)] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Permission Denied - Help Requested
On Mon, Mar 28, 2011 at 11:03 PM, Ethan Rosenberg eth...@earthlink.netwrote: At 01:32 AM 3/28/2011, Hans Åhlin wrote: Do you have SELinux installed? 2011/3/28 Ethan Rosenberg eth...@earthlink.net: Dear List - Thanks for all your help in the past.  Here is another one... I am getting a Permission Denied message when I try to run a PHP script.  I just changed the mode on the directory and the files to 777.  This problem arose when I changed the permissions.  I thought I was solving a problem, because I could not open a file for writing.  I was not receiving error messages, but no file was created. Help and advice, please. Ethan Rosenberg **  Hans Åhlin   Tel: +46761488019   icq: 275232967   http://www.kronan-net.com/   irc://irc.freenode.net:6667 - TheCoin ** Hans - Sorry, I did not include my signature, which includes all the requested information. Here it is Ethan == MySQL 5.1 PHP 5.3.3-6 Linux [Debian (sid)] The problem persists. I cannot write to a file from PHP. Any more suggestions? Thanks. Ethan Hi Ethan, Are you using suPHP or suExec? I believe the server chokes on 777 permissions in those cases. Have you checked the permissions in the command line (sorry for the basic question, but just making sure I know what you've already done?) Also, can we see some of the code you're using to handle the file processing? Thanks, Adam -- Nephtali: A simple, flexible, fast, and security-focused PHP framework http://nephtaliproject.com
[PHP] Permission Denied
Dear List - Thanks for all your help in the past. Here is another one... I am getting a Permission Denied message when I try to run a PHP script. I just changed the mode on the directory and the files to 777. This problem arose when I changed the permissions. I thought I was solving a problem, because I could not open a file for writing. I was not receiving error messages, but no file was created. Help and advice, please. Ethan Rosenberg -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Permission Denied
Do you have SELinux installed? 2011/3/28 Ethan Rosenberg eth...@earthlink.net: Dear List - Thanks for all your help in the past. Here is another one... I am getting a Permission Denied message when I try to run a PHP script. I just changed the mode on the directory and the files to 777. This problem arose when I changed the permissions. I thought I was solving a problem, because I could not open a file for writing. I was not receiving error messages, but no file was created. Help and advice, please. Ethan Rosenberg -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- ** Hans Åhlin Tel: +46761488019 icq: 275232967 http://www.kronan-net.com/ irc://irc.freenode.net:6667 - TheCoin ** -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Permission Denied (in FTP)
Hello, I'm having some slight issues. I have a script which creates a directory and then copies a blank file into it 4 times each with different names. Here's the code which does it: ?php $folder = str_replace(' ', '_', $HTTP_POST_VARS['title']); $folder = str_replace('.', '', $folder); mkdir('./tutorials/'.$HTTP_POST_VARS['folder'].'/'.$folder, 0777); copy('./tutorials/blank.txt', './tutorials/'.$HTTP_POST_VARS['folder'].'/'.$folder.'/desc.txt'); copy('./tutorials/blank.txt', './tutorials/'.$HTTP_POST_VARS['folder'].'/'.$folder.'/rating.txt'); copy('./tutorials/blank.txt', './tutorials/'.$HTTP_POST_VARS['folder'].'/'.$folder.'/overview.txt'); copy('./tutorials/blank.txt', './tutorials/'.$HTTP_POST_VARS['folder'].'/'.$folder.'/views.txt'); chmod('./tutorials/'.$HTTP_POST_VARS['folder'].'/'.$folder.'/desc.txt', 0777); chmod('./tutorials/'.$HTTP_POST_VARS['folder'].'/'.$folder.'/rating.txt', 0777); chmod('./tutorials/'.$HTTP_POST_VARS['folder'].'/'.$folder.'/overview.txt', 0777); chmod('./tutorials/'.$HTTP_POST_VARS['folder'].'/'.$folder.'/views.txt', 0777); $fp = fopen('./tutorials/'.$HTTP_POST_VARS['folder'].'/'.$folder.'/desc.txt', 'w+'); fwrite($fp, $HTTP_POST_VARS['desc']); $fp = fopen('./tutorials/'.$HTTP_POST_VARS['folder'].'/'.$folder.'/overview.txt', 'w+'); fwrite($fp, $HTTP_POST_VARS['overview']); $fp = fopen('./tutorials/'.$HTTP_POST_VARS['folder'].'/'.$folder.'/views.txt', 'w+'); fwrite($fp, '0'); $fp = fopen('./tutorials/'.$HTTP_POST_VARS['folder'].'/'.$folder.'/rating.txt', 'w+'); fwrite($fp, '0'); ? After all that is done, it's fine. The problem I'm having is deleting the folder in an FTP client. Whenever I go to delete it, it says it cannot delete desc.txt because permission is denied. Is there any way to make it so it can be deleted? Please help and reply soon. Thanks! Thank you, Stephen Craton Senior Executive Web Developer Mophus.com, Inc. Lead Programmer/Webmaster WiredPHP (http://php.melchior.us)
[PHP] Permission Denied
Hello, I'm having a few problems with deleting items. When I do the unlink() function, it gives me a permission denied error. For example..here's the code: unlink($this-currentfolder().'/packs/'.$title.'/'.$intname); Here's the error returned: Warning: unlink() failed (Permission denied) in /usr/local/plesk/apache/vhosts/piw.melchior.us/httpdocs/phpiw/classes/class. delete.php on line 45 The problem with all this is, I dynamically create the directories and files and dynamically CHMOD them all to 777 with no problems. I don't see why I'm getting all this! Please help ASAP! Thanks in advance! Thanks, Stephen Craton http://www.melchior.us -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Permission Denied
Hello, I'm having a few problems with deleting items. When I do the unlink() function, it gives me a permission denied error. For example..here's the code: unlink($this-currentfolder().'/packs/'.$title.'/'.$intname); Here's the error returned: Warning: unlink() failed (Permission denied) in /usr/local/plesk/apache/vhosts/piw.melchior.us/httpdocs/phpiw/classes/class. delete.php on line 45 The problem with all this is, I dynamically create the directories and files and dynamically CHMOD them all to 777 with no problems. I don't see why I'm getting all this! Please help ASAP! Thanks in advance! Thanks, Stephen Craton http://www.melchior.us -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Permission Denied
My Full system settings are IIS 6.1, Windows XP Professional, etc. I'll be publishing the script later and most will have CHMOD settings. Now I guess I need to know how to fix it on my test server and then what the CHMOD settings should be... As for Sean's email, I just did those settings and I'll have the results later today. I'm only home for lunch, need to get back to school... - Original Message - From: Timothy Hitchens (HiTCHO) [EMAIL PROTECTED] To: 'Stephen' [EMAIL PROTECTED]; [EMAIL PROTECTED] Cc: 'PHP List' [EMAIL PROTECTED] Sent: Sunday, January 12, 2003 11:05 PM Subject: RE: [PHP] Permission Denied : Who owns the htdocs root (I know it is Windows) when you right click you : should should see sharing/security. : : Do you if not what OS Ver are you using? : : : : Timothy Hitchens (HiTCHO) : Open Platform Consulting : e-mail: [EMAIL PROTECTED] : : -Original Message- : From: Stephen [mailto:[EMAIL PROTECTED]] : Sent: Monday, 13 January 2003 1:36 PM : To: [EMAIL PROTECTED] : Cc: PHP List : Subject: Re: [PHP] Permission Denied : : : Yes, I just added it but same error: : : Warning: mkdir(c:\inetpub\wwwroot\phpiw\packs\bob) : [function.mkdir]: Permission denied in : c:\inetpub\wwwroot\phpiw\classes\class.cp.php on line 28 : : Here's the part where I try and make the folder: : : function do_dir($package) { : umask(0); : if(mkdir($this-currentfolder().'packs\\bob', 0777)) { : return true; : } else { :echo 'There is already a package by the name of : '.$package.'! Delete it and try again.brbr'; :return false; : } : } : : Any ideas? : - Original Message - : From: Timothy Hitchens (HiTCHO) [EMAIL PROTECTED] : To: 'Stephen' [EMAIL PROTECTED]; [EMAIL PROTECTED] : Sent: Sunday, January 12, 2003 6:33 PM : Subject: RE: [PHP] Permission Denied : : : : Did you use the umask(0) prior to the mkdir() in your script?? : : : : : : Timothy Hitchens (HiTCHO) : : Open Platform Consulting : : e-mail: [EMAIL PROTECTED] : : : : -Original Message- : : From: Stephen [mailto:[EMAIL PROTECTED]] : : Sent: Monday, 13 January 2003 9:09 AM : : To: [EMAIL PROTECTED] : : Subject: Re: [PHP] Permission Denied : : : : : : Ok, I got it to make a directory as a absolute path but I'm : : getting a Permission Denied error again. I'm running IIS so : : I can't CHMOD and all the permission options are checked in : : the options box. : : : : : : - Original Message - : : From: Jason Wong [EMAIL PROTECTED] : : To: [EMAIL PROTECTED] : : Sent: Sunday, January 12, 2003 4:03 AM : : Subject: Re: [PHP] Permission Denied : : : : : : : On Sunday 12 January 2003 10:10, Stephen wrote: : : : There's already a folder named packs but my problem was : : not having the / : : : before it. One more question. How can I dynamically get : : the path to the : : : current folder? Like your at : : http://www.bob.com/joe/index.php and you want : : : to get the : : http://www.bob.com/joe/ bit and do it dynamically? : : : : : : print_r($_SERVER) will show you which bits you can use. : : : : : : -- : : : Jason Wong - Gremlins Associates - www.gremlins.biz : : : Open Source Software Systems Integrators : : : * Web Design Hosting * Internet Intranet Applications : : Development * : : : : : : /* : : : I'll show you MY telex number if you show me YOURS ... : : : */ : : : : : : : : : -- : : : 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 : : : : : : : : : : : : : -- : 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] Permission Denied
Ok, I finally just right clicked on my wwwroot folder and went to security. I allowed control to everyone on the network (just me and my brothers) and it works. Just one last question! What should the CHMOD settings be for when it goes online? - Original Message - From: Sean Malloy [EMAIL PROTECTED] To: Stephen [EMAIL PROTECTED]; PHP List [EMAIL PROTECTED] Sent: Sunday, January 12, 2003 10:40 PM Subject: RE: [PHP] Permission Denied : I'm assuming you are using IIS. : : If your harddrive is formatted using NTFS, you are going to have to add a : new entry to the ACL list for the directory to let the IUSR_machinename : account access the directory. : : There are plenty of readmes/articles on managing NTFS permissions. I don't : have time to go into the details of how to do it, only to tell you that that : is what you have to do. : : BTW; By default Windows XP (If thats what you are using) enables Simple : Sharing/File Permisisons. To turn that off : : in Windows Explorer; : : Tools | Folder Options | View | (Scroll Right Down to bottom) Use simple : sharing -- untick : : : -Original Message- : From: Stephen [mailto:[EMAIL PROTECTED]] : Sent: Monday, 13 January 2003 2:36 PM : To: [EMAIL PROTECTED] : Cc: PHP List : Subject: Re: [PHP] Permission Denied : : : Yes, I just added it but same error: : : Warning: mkdir(c:\inetpub\wwwroot\phpiw\packs\bob) [function.mkdir]: : Permission denied in c:\inetpub\wwwroot\phpiw\classes\class.cp.php on line : 28 : : Here's the part where I try and make the folder: : : function do_dir($package) { : umask(0); : if(mkdir($this-currentfolder().'packs\\bob', 0777)) { : return true; : } else { : echo 'There is already a package by the name of '.$package.'! Delete : it and try again.brbr'; : return false; : } :} : : Any ideas? : - Original Message - : From: Timothy Hitchens (HiTCHO) [EMAIL PROTECTED] : To: 'Stephen' [EMAIL PROTECTED]; [EMAIL PROTECTED] : Sent: Sunday, January 12, 2003 6:33 PM : Subject: RE: [PHP] Permission Denied : : : : Did you use the umask(0) prior to the mkdir() in your script?? : : : : : : Timothy Hitchens (HiTCHO) : : Open Platform Consulting : : e-mail: [EMAIL PROTECTED] : : : : -Original Message- : : From: Stephen [mailto:[EMAIL PROTECTED]] : : Sent: Monday, 13 January 2003 9:09 AM : : To: [EMAIL PROTECTED] : : Subject: Re: [PHP] Permission Denied : : : : : : Ok, I got it to make a directory as a absolute path but I'm : : getting a Permission Denied error again. I'm running IIS so : : I can't CHMOD and all the permission options are checked in : : the options box. : : : : : : - Original Message - : : From: Jason Wong [EMAIL PROTECTED] : : To: [EMAIL PROTECTED] : : Sent: Sunday, January 12, 2003 4:03 AM : : Subject: Re: [PHP] Permission Denied : : : : : : : On Sunday 12 January 2003 10:10, Stephen wrote: : : : There's already a folder named packs but my problem was : : not having the / : : : before it. One more question. How can I dynamically get : : the path to the : : : current folder? Like your at : : http://www.bob.com/joe/index.php and you want : : : to get the : : http://www.bob.com/joe/ bit and do it dynamically? : : : : : : print_r($_SERVER) will show you which bits you can use. : : : : : : -- : : : Jason Wong - Gremlins Associates - www.gremlins.biz : : : Open Source Software Systems Integrators : : : * Web Design Hosting * Internet Intranet Applications : : Development * : : : : : : /* : : : I'll show you MY telex number if you show me YOURS ... : : : */ : : : : : : : : : -- : : : 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 : : : : : : : : : : : : -- : 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 : : -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] permission denied
Using MS Win98 / php 4: Any ideas on how I can change my permssion settings on a file called data.txt so it can be read to and written to or do I have to take that up with my ISP. I get the following after I submit a form: Warning: fopen(data.txt, a+) - Permission denied in d:\inetpub\www.blahblah.org\formtest.php on line 80 Your submission was not processed. Thank you for your time and help. TR -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Permission Denied
On Sunday 12 January 2003 10:10, Stephen wrote: There's already a folder named packs but my problem was not having the / before it. One more question. How can I dynamically get the path to the current folder? Like your at http://www.bob.com/joe/index.php and you want to get the http://www.bob.com/joe/ bit and do it dynamically? print_r($_SERVER) will show you which bits you can use. -- Jason Wong - Gremlins Associates - www.gremlins.biz Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * /* I'll show you MY telex number if you show me YOURS ... */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Permission Denied
Did you use the umask(0) prior to the mkdir() in your script?? Timothy Hitchens (HiTCHO) Open Platform Consulting e-mail: [EMAIL PROTECTED] -Original Message- From: Stephen [mailto:[EMAIL PROTECTED]] Sent: Monday, 13 January 2003 9:09 AM To: [EMAIL PROTECTED] Subject: Re: [PHP] Permission Denied Ok, I got it to make a directory as a absolute path but I'm getting a Permission Denied error again. I'm running IIS so I can't CHMOD and all the permission options are checked in the options box. - Original Message - From: Jason Wong [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Sunday, January 12, 2003 4:03 AM Subject: Re: [PHP] Permission Denied : On Sunday 12 January 2003 10:10, Stephen wrote: : There's already a folder named packs but my problem was not having the / : before it. One more question. How can I dynamically get the path to the : current folder? Like your at http://www.bob.com/joe/index.php and you want : to get the http://www.bob.com/joe/ bit and do it dynamically? : : print_r($_SERVER) will show you which bits you can use. : : -- : Jason Wong - Gremlins Associates - www.gremlins.biz : Open Source Software Systems Integrators : * Web Design Hosting * Internet Intranet Applications Development * : : /* : I'll show you MY telex number if you show me YOURS ... : */ : : : -- : 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 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Permission Denied
Yes, I just added it but same error: Warning: mkdir(c:\inetpub\wwwroot\phpiw\packs\bob) [function.mkdir]: Permission denied in c:\inetpub\wwwroot\phpiw\classes\class.cp.php on line 28 Here's the part where I try and make the folder: function do_dir($package) { umask(0); if(mkdir($this-currentfolder().'packs\\bob', 0777)) { return true; } else { echo 'There is already a package by the name of '.$package.'! Delete it and try again.brbr'; return false; } } Any ideas? - Original Message - From: Timothy Hitchens (HiTCHO) [EMAIL PROTECTED] To: 'Stephen' [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Sunday, January 12, 2003 6:33 PM Subject: RE: [PHP] Permission Denied : Did you use the umask(0) prior to the mkdir() in your script?? : : : Timothy Hitchens (HiTCHO) : Open Platform Consulting : e-mail: [EMAIL PROTECTED] : : -Original Message- : From: Stephen [mailto:[EMAIL PROTECTED]] : Sent: Monday, 13 January 2003 9:09 AM : To: [EMAIL PROTECTED] : Subject: Re: [PHP] Permission Denied : : : Ok, I got it to make a directory as a absolute path but I'm : getting a Permission Denied error again. I'm running IIS so : I can't CHMOD and all the permission options are checked in : the options box. : : : - Original Message - : From: Jason Wong [EMAIL PROTECTED] : To: [EMAIL PROTECTED] : Sent: Sunday, January 12, 2003 4:03 AM : Subject: Re: [PHP] Permission Denied : : : : On Sunday 12 January 2003 10:10, Stephen wrote: : : There's already a folder named packs but my problem was : not having the / : : before it. One more question. How can I dynamically get : the path to the : : current folder? Like your at : http://www.bob.com/joe/index.php and you want : : to get the : http://www.bob.com/joe/ bit and do it dynamically? : : : : print_r($_SERVER) will show you which bits you can use. : : : : -- : : Jason Wong - Gremlins Associates - www.gremlins.biz : : Open Source Software Systems Integrators : : * Web Design Hosting * Internet Intranet Applications : Development * : : : : /* : : I'll show you MY telex number if you show me YOURS ... : : */ : : : : : : -- : : 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 : : : : -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Permission Denied
I'm assuming you are using IIS. If your harddrive is formatted using NTFS, you are going to have to add a new entry to the ACL list for the directory to let the IUSR_machinename account access the directory. There are plenty of readmes/articles on managing NTFS permissions. I don't have time to go into the details of how to do it, only to tell you that that is what you have to do. BTW; By default Windows XP (If thats what you are using) enables Simple Sharing/File Permisisons. To turn that off in Windows Explorer; Tools | Folder Options | View | (Scroll Right Down to bottom) Use simple sharing -- untick -Original Message- From: Stephen [mailto:[EMAIL PROTECTED]] Sent: Monday, 13 January 2003 2:36 PM To: [EMAIL PROTECTED] Cc: PHP List Subject: Re: [PHP] Permission Denied Yes, I just added it but same error: Warning: mkdir(c:\inetpub\wwwroot\phpiw\packs\bob) [function.mkdir]: Permission denied in c:\inetpub\wwwroot\phpiw\classes\class.cp.php on line 28 Here's the part where I try and make the folder: function do_dir($package) { umask(0); if(mkdir($this-currentfolder().'packs\\bob', 0777)) { return true; } else { echo 'There is already a package by the name of '.$package.'! Delete it and try again.brbr'; return false; } } Any ideas? - Original Message - From: Timothy Hitchens (HiTCHO) [EMAIL PROTECTED] To: 'Stephen' [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Sunday, January 12, 2003 6:33 PM Subject: RE: [PHP] Permission Denied : Did you use the umask(0) prior to the mkdir() in your script?? : : : Timothy Hitchens (HiTCHO) : Open Platform Consulting : e-mail: [EMAIL PROTECTED] : : -Original Message- : From: Stephen [mailto:[EMAIL PROTECTED]] : Sent: Monday, 13 January 2003 9:09 AM : To: [EMAIL PROTECTED] : Subject: Re: [PHP] Permission Denied : : : Ok, I got it to make a directory as a absolute path but I'm : getting a Permission Denied error again. I'm running IIS so : I can't CHMOD and all the permission options are checked in : the options box. : : : - Original Message - : From: Jason Wong [EMAIL PROTECTED] : To: [EMAIL PROTECTED] : Sent: Sunday, January 12, 2003 4:03 AM : Subject: Re: [PHP] Permission Denied : : : : On Sunday 12 January 2003 10:10, Stephen wrote: : : There's already a folder named packs but my problem was : not having the / : : before it. One more question. How can I dynamically get : the path to the : : current folder? Like your at : http://www.bob.com/joe/index.php and you want : : to get the : http://www.bob.com/joe/ bit and do it dynamically? : : : : print_r($_SERVER) will show you which bits you can use. : : : : -- : : Jason Wong - Gremlins Associates - www.gremlins.biz : : Open Source Software Systems Integrators : : * Web Design Hosting * Internet Intranet Applications : Development * : : : : /* : : I'll show you MY telex number if you show me YOURS ... : : */ : : : : : : -- : : 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 : : : : -- 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] Permission Denied
Who owns the htdocs root (I know it is Windows) when you right click you should should see sharing/security. Do you if not what OS Ver are you using? Timothy Hitchens (HiTCHO) Open Platform Consulting e-mail: [EMAIL PROTECTED] -Original Message- From: Stephen [mailto:[EMAIL PROTECTED]] Sent: Monday, 13 January 2003 1:36 PM To: [EMAIL PROTECTED] Cc: PHP List Subject: Re: [PHP] Permission Denied Yes, I just added it but same error: Warning: mkdir(c:\inetpub\wwwroot\phpiw\packs\bob) [function.mkdir]: Permission denied in c:\inetpub\wwwroot\phpiw\classes\class.cp.php on line 28 Here's the part where I try and make the folder: function do_dir($package) { umask(0); if(mkdir($this-currentfolder().'packs\\bob', 0777)) { return true; } else { echo 'There is already a package by the name of '.$package.'! Delete it and try again.brbr'; return false; } } Any ideas? - Original Message - From: Timothy Hitchens (HiTCHO) [EMAIL PROTECTED] To: 'Stephen' [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Sunday, January 12, 2003 6:33 PM Subject: RE: [PHP] Permission Denied : Did you use the umask(0) prior to the mkdir() in your script?? : : : Timothy Hitchens (HiTCHO) : Open Platform Consulting : e-mail: [EMAIL PROTECTED] : : -Original Message- : From: Stephen [mailto:[EMAIL PROTECTED]] : Sent: Monday, 13 January 2003 9:09 AM : To: [EMAIL PROTECTED] : Subject: Re: [PHP] Permission Denied : : : Ok, I got it to make a directory as a absolute path but I'm : getting a Permission Denied error again. I'm running IIS so : I can't CHMOD and all the permission options are checked in : the options box. : : : - Original Message - : From: Jason Wong [EMAIL PROTECTED] : To: [EMAIL PROTECTED] : Sent: Sunday, January 12, 2003 4:03 AM : Subject: Re: [PHP] Permission Denied : : : : On Sunday 12 January 2003 10:10, Stephen wrote: : : There's already a folder named packs but my problem was : not having the / : : before it. One more question. How can I dynamically get : the path to the : : current folder? Like your at : http://www.bob.com/joe/index.php and you want : : to get the : http://www.bob.com/joe/ bit and do it dynamically? : : : : print_r($_SERVER) will show you which bits you can use. : : : : -- : : Jason Wong - Gremlins Associates - www.gremlins.biz : : Open Source Software Systems Integrators : : * Web Design Hosting * Internet Intranet Applications : Development * : : : : /* : : I'll show you MY telex number if you show me YOURS ... : : */ : : : : : : -- : : 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 : : : : -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Permission Denied
Why do I get this error whenever I try to CHMOD something in PHP or create a directory (in this case): Warning: mkdir(packs/bob) [function.mkdir]: Permission denied in c:\inetpub\wwwroot\phpiw\classes\class.cp.php on line 20 Here's line 20 of class.cp.php: mkdir('packs/'.$package, 0777); Any help would be great! Thanks,Stephen Cratonhttp://www.melchior.us "What's the point in appearance if your true love, doesn't care about it?" -- http://www.melchior.us -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Permission Denied
There's already a folder named packs but my problem was not having the / before it. One more question. How can I dynamically get the path to the current folder? Like your at http://www.bob.com/joe/index.php and you want to get the http://www.bob.com/joe/ bit and do it dynamically? - Original Message - From: Chris Hayes [EMAIL PROTECTED] To: Stephen [EMAIL PROTECTED] Sent: Saturday, January 11, 2003 8:49 PM Subject: Re: [PHP] Permission Denied : At 02:40 12-1-2003, you wrote: : Why do I get this error whenever I try to CHMOD something in PHP or create : a directory (in this case): : : Warning: mkdir(packs/bob) : [http://www.php.net/function.mkdirfunction.mkdir]: Permission denied in : c:\inetpub\wwwroot\phpiw\classes\class.cp.php on line 20 : : Here's line 20 of class.cp.php: : : mkdir('packs/'.$package, 0777); : : I suppose you have no dir creation rights in the dir in which you want to : add this. : : I also think you can only mkdir one directory at a time, if so you need to : make 'packs' first, then 'bob'. But that would need testing. : : : -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Permission Denied
The user/group (commonly nobody.nogroup or nobody.nobody) that your web server runs under probably does not have the permissions necessary to chmod those directories (ie: they are owned by someone else). Quoting Stephen [EMAIL PROTECTED]: Why do I get this error whenever I try to CHMOD something in PHP or create a directory (in this case): Warning: mkdir(packs/bob) [function.mkdir]: Permission denied in c:\inetpub\wwwroot\phpiw\classes\class.cp.php on line 20 Here's line 20 of class.cp.php: mkdir('packs/'.$package, 0777); Any help would be great! Thanks, Stephen Craton http://www.melchior.us What's the point in appearance if your true love, doesn't care about it? -- http://www.melchior.us - End forwarded message - -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Permission Denied
I use PHP to send mail. Recently, emails originating from the server stopped sending. After some investigation, I looked at the /var/log/maillog file, and saw the following errors when a mailing tried to originate: Aug 29 13:16:10 x sendmail[1162]: g7TIGA001162: SYSERR(apache): Can't create transcript file ./xfg7TIGA001162: Permission denied Aug 29 13:16:10 x sendmail[1162]: g7TIGA001162: SYSERR(apache): Cannot create ./dfg7TIGA001162: Permission denied I looked in my mail queue directory, and there were like 15,000 files...looked at a sample few of them, and they were jibberish. Question 1: I'm assuming the error has something to do with the chown/chgrp/chmod of the /var/spool/mqueue directory? I don't know how this could have changed, nothing was modified on the server. Currently: owner = root, group = mail, permissions = rwx rx rx Question 2: Did I get hacked?? __ Do You Yahoo!? Yahoo! Finance - Get real-time stock quotes http://finance.yahoo.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] permission denied using COPY function?
Trying to use the COPY function to allow user uploads to a site, along the lines of: copy(temp directory, directory on my server). However, I'm getting an error: Warning: Unable to create 'directory/image name': Permission denied in myPHPfile on line x (where x is the COPY function). I've set owner permission to RWX on both the PHP file where the function is, and the directory to which the files are being uploaded. Any ideas why I'm still getting permission denied? Apologies if this question has come around before. __ Do You Yahoo!? Yahoo! Sports - live college hoops coverage http://sports.yahoo.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Permission denied, although permissions are right
Hi, I'm trying to open a file (using fopen) in the /tmp directory which is owned by user 'zapman'. The php script is also owned by user 'zapman'. However, when I try to run it, I get : Warning: fopen(/tmp/1.dat,r) - Permission denied in /documents/zapman/html/openfile.php on line 5 If I do a ps auwx | grep http, I get : root 20341 0.0 0.0 15100 56 ?S12:46 0:02 /usr/local/apache/bin/httpd -DSSL nobody 20342 0.6 3.3 18276 4184 ?S12:46 0:26 /usr/local/apache/bin/httpd -DSSL nobody 20343 0.8 4.6 20008 5936 ?S12:46 0:35 /usr/local/apache/bin/httpd -DSSL nobody 20344 0.3 3.2 16100 4108 ?S12:46 0:15 /usr/local/apache/bin/httpd -DSSL So the main process is running as root, the rest is running as nobody... that's the way to do it, right ? Or should I run Apache as root (which I don't like at all !) ? Greetings, Wim Godden -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Permission Denied when copying file?
Hello- I'm having a problem once I upload a file and I need to copy it to a new directory using php. The error message I keep getting is this: Warning: Unable to create '/home/krox/krox.com/htdocs/images/101x_button.gif': Permission denied in /php/news/news.class.php on line 227 My question is how do I give permission so that I can copy the file to the correct place? Thanks, Jay -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Permission denied
Hi all, I'm trying to upload a file from a client browser to my server. On the client side, I've got: FORM ENCTYPE="multipart/form-data" ACTION="upload.php" METHOD=POST !-- INPUT TYPE="hidden" name="MAX_FILE_SIZE" value="1000" -- Send this file: INPUT NAME="userfile" TYPE="file" INPUT TYPE="submit" VALUE="Send File" /FORM On the server side, I've got: echo ("$userfilebr"); echo ($HTTP_POST_FILES['userfile']['name'] ."br"); echo ($HTTP_POST_FILES['userfile']['type'] ."br"); echo ($HTTP_POST_FILES['userfile']['size'] ."br"); echo ($HTTP_POST_FILES['userfile']['tmp_name'] ."br"); if (move_uploaded_file($userfile, "/home/jalmberg/public_html/qiksys/images/temp.jpg")) print("moved file"); else print("couldn't move file!"); When I try to use this, I get: = /tmp/phpa21470 test.jpg image/pjpeg 21917 /tmp/phpa21470 Warning: Unable to create '/home/jalmberg/public_html/qiksys/images/temp.jpg': Permission denied in /home/jalmberg/public_html/qiksys/upload.php on line 57 Warning: Unable to move '/tmp/phpa21470' to '/home/jalmberg/public_html/qiksys/images/temp.jpg' in /home/jalmberg/public_html/qiksys/upload.php on line 57 couldn't move file! == I check the php.ini file and safe mode is turned off. I've also tried with a text file, same result. I have permission to access the above directory . . . the php files working this magic are located in /home/jalmberg/public_html/qiksys. Probably there is a simple answer to this question, but I'm out of ideas! Any help??? Thanks in advance. John -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Permission denied
Don't forget, PHP (in general) runs as the webserver (normally "nobody" or "apache" for Apache servers). Make sure your webserver has write access to /home/jalmberg/public_html/qiksys/images/ adamw - Original Message - From: "John Almberg" [EMAIL PROTECTED] To: "PHP General List" [EMAIL PROTECTED] Sent: Friday, March 23, 2001 2:50 PM Subject: [PHP] Permission denied Hi all, I'm trying to upload a file from a client browser to my server. On the client side, I've got: FORM ENCTYPE="multipart/form-data" ACTION="upload.php" METHOD=POST !-- INPUT TYPE="hidden" name="MAX_FILE_SIZE" value="1000" -- Send this file: INPUT NAME="userfile" TYPE="file" INPUT TYPE="submit" VALUE="Send File" /FORM On the server side, I've got: echo ("$userfilebr"); echo ($HTTP_POST_FILES['userfile']['name'] ."br"); echo ($HTTP_POST_FILES['userfile']['type'] ."br"); echo ($HTTP_POST_FILES['userfile']['size'] ."br"); echo ($HTTP_POST_FILES['userfile']['tmp_name'] ."br"); if (move_uploaded_file($userfile, "/home/jalmberg/public_html/qiksys/images/temp.jpg")) print("moved file"); else print("couldn't move file!"); When I try to use this, I get: = /tmp/phpa21470 test.jpg image/pjpeg 21917 /tmp/phpa21470 Warning: Unable to create '/home/jalmberg/public_html/qiksys/images/temp.jpg': Permission denied in /home/jalmberg/public_html/qiksys/upload.php on line 57 Warning: Unable to move '/tmp/phpa21470' to '/home/jalmberg/public_html/qiksys/images/temp.jpg' in /home/jalmberg/public_html/qiksys/upload.php on line 57 couldn't move file! == I check the php.ini file and safe mode is turned off. I've also tried with a text file, same result. I have permission to access the above directory . . . the php files working this magic are located in /home/jalmberg/public_html/qiksys. Probably there is a simple answer to this question, but I'm out of ideas! Any help??? Thanks in advance. John -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] Permission denied
Hi Adam, thanks for your quick repsonse. I'm just renting space on a (Linux/Apache) server, so I don't have any control over how PHP is configured on the machine. Perhaps there is a way for me to change my 'local' PHP configuration? I don't know much about this aspect of PHP, obviously. I'm just trying to ask obvious questions. Alternatively, can my PHP application log-in, and thus obtain permission? John -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] Permission denied
Adam, Just ran phpinfo and you are correct: the Apache User/Group is "nobody". H'. This sounds like a problem. Hope there is an answer! - John -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Permission denied
If you have shell access to the box, you can chgrp some stuff and allow PHP to write to it. Otherwise, you'll have to talk to the ISP directly (get them to setup setuid versions of common shell commands for this sort of requirement). There is no way to make PHP 'login', any as PHP is server side, nothing you change locally can affect it. adamw - Original Message - From: "John Almberg" [EMAIL PROTECTED] To: "PHP General List" [EMAIL PROTECTED] Sent: Friday, March 23, 2001 3:27 PM Subject: RE: [PHP] Permission denied Adam, Just ran phpinfo and you are correct: the Apache User/Group is "nobody". H'. This sounds like a problem. Hope there is an answer! - John -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] Permission denied
Whoopee!!! After two days of propeller-spinning, I finally uploaded a file successfully!!! I had to use an FTP connection to do it, because my PHP process didn't have permission to write files to my directory, but that's fine. Here's the code snippet that worked the trick, with my servername/username/password changed to protect the innocent (me!) Thanks to Adam for putting me on the right track, vis-a-vis file permissions. John = echo ("$userfilebr"); echo ($HTTP_POST_FILES['userfile']['name'] ."br"); echo ($HTTP_POST_FILES['userfile']['type'] ."br"); echo ($HTTP_POST_FILES['userfile']['size'] ."br"); echo ($HTTP_POST_FILES['userfile']['tmp_name'] ."br"); //= // FTP //= $ftp_server = "server.name.com"; $ftp_user_name = "username"; $ftp_user_pass = "password"; // open source file if ($fd = fopen($userfile, "r") or die ("Can't open file $srcbr")) print("opened file $userfilebr"); else die("couldn't open src file $srcbr"); // set up basic FTP connection $conn_id = ftp_connect("$ftp_server"); // login with username and password $login_result = ftp_login($conn_id, "$ftp_user_name", "$ftp_user_pass"); // check connection if ((!$conn_id) || (!$login_result)) echo "Ftp connection has failed!br"; echo "Attempted to connect to $ftp_server for user $userbr"; die; } else { echo "Connected to $ftp_server, for user $ftp_user_namebr"; } if (ftp_fput($conn_id, "testfile.txt", $fd, FTP_BINARY)) { print("ftp_fput success!!!br"); } else { print("ftp_put failure!!!br"); } ftp_quit($conn_id); fclose($fd); // -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]