blakestar Posted September 10, 2007 Share Posted September 10, 2007 I have a test server which is running SUSE9.2, Apache2+php4. Whenever I upload a file to the www directory and attempt to open it in a browser I receive the following error message: PHP Warning: Unknown(/www/test.php): failed to open stream: Permission denied in Unknown on line 0 PHP Warning: (null)(): Failed opening '/www/test.php' for inclusion (include_path='.:') in Unknown on line 0 Now if I chmod a+rx /www/test.php the file runs ok, no error messages. I should note I have to chmod ALL files including any new images, videos, .html files, etc. otherwise apache will not display the file in the browser, example attempting to display a .htm file brings up a HTTP Error 403 - Forbidden error. Is their a setting or directive in php.ini or apache's httpd.conf that I can set so that I do not have to chmod a+rx all new files? Quote Link to comment https://forums.phpfreaks.com/topic/68707-question-about-apachephp-file-chmod/ Share on other sites More sharing options...
effigy Posted September 10, 2007 Share Posted September 10, 2007 Can you chmod the uploaded file? Quote Link to comment https://forums.phpfreaks.com/topic/68707-question-about-apachephp-file-chmod/#findComment-345402 Share on other sites More sharing options...
blakestar Posted September 10, 2007 Author Share Posted September 10, 2007 Yes, I have to chmod any new file which is uploaded, then it works correctly. The problem is, I am getting tired of doing this. I would like to upload a file and start testing rather than 1.) Upload 2.) chmod 3.) test Quote Link to comment https://forums.phpfreaks.com/topic/68707-question-about-apachephp-file-chmod/#findComment-345413 Share on other sites More sharing options...
effigy Posted September 10, 2007 Share Posted September 10, 2007 No, I mean chmod the file using PHP during the upload process--not going to the server to run chmod. Quote Link to comment https://forums.phpfreaks.com/topic/68707-question-about-apachephp-file-chmod/#findComment-345443 Share on other sites More sharing options...
blakestar Posted September 10, 2007 Author Share Posted September 10, 2007 Ah, I see what you mean... Yes that would be one possible solution and maybe the only solution if I cannot figure this thing out. Is their any <Directory> settings in apache .conf which would control what files apache can serve without these permissions? Here is the error log report from apache: [Mon Sep 10 07:17:52 2007] [error] [client 192.168.1.5] (13)Permission denied: file permissions deny server access: /www/file.html Quote Link to comment https://forums.phpfreaks.com/topic/68707-question-about-apachephp-file-chmod/#findComment-345640 Share on other sites More sharing options...
effigy Posted September 11, 2007 Share Posted September 11, 2007 Not that I'm aware of. You can try changing your umask before moving the file into place. I'm not positive this will work. Quote Link to comment https://forums.phpfreaks.com/topic/68707-question-about-apachephp-file-chmod/#findComment-345688 Share on other sites More sharing options...
blakestar Posted September 11, 2007 Author Share Posted September 11, 2007 umask in vsftpd.conf worked: Commented out the line in vsftpd.conf #local_umask=022 reboot xinetd.... and it works. Quote Link to comment https://forums.phpfreaks.com/topic/68707-question-about-apachephp-file-chmod/#findComment-345694 Share on other sites More sharing options...
effigy Posted September 11, 2007 Share Posted September 11, 2007 I'm confused. I thought PHP was doing the uploading, thus controlling the file permissions. Perhaps you're using both. Either way, is this topic solved? Quote Link to comment https://forums.phpfreaks.com/topic/68707-question-about-apachephp-file-chmod/#findComment-345737 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.