PDA

View Full Version : 500 internal error if files has write permission in the group


Thomas Jensen
23rd July 2009, 12:54
Hi,

I have a PHP site, which allows me to upload pictures.
There's no trouble uploading the file, but the the file permissions on the picture is not "read by all groups", and the result is that i can't view the file in a browser.
My first thought was the give the uploading PHP file permissions to write, but when i do that, i get an internal error 500.

It's running in suPHP.

Thomas Jensen
27th July 2009, 11:38
Please, anybody?

Mark_NL
27th July 2009, 11:45
what does your apache error log tell you when you get the 500 error?

till
27th July 2009, 12:02
This is one of the security mechanisms of suphp, you can change this in the suphp.conf file.

Thomas Jensen
27th July 2009, 12:14
Okay, where do i find it?

till
27th July 2009, 12:18
Almost all linux config files are in /etc. As the program is named suphp, you will find the file in the directory /etc/suphp/

And in case that you dont find a file on your server, just use the command locate. E.g.:

locate suphp.conf

Thomas Jensen
27th July 2009, 12:52
Found it, thanks, but:

server1:/# locate suphp.conf
-bash: locate: command not found

The images is still only given read and write permissions for owner, and can't be viewed in the browser :(

till
27th July 2009, 12:53
The images is still only given read and write permissions for owner, and can't be viewed in the browser

Then this is a problem with your image upload script as the permissions of the file are set by the php script that uploads the file.

Thomas Jensen
27th July 2009, 12:59
I use the same script which worked on another server, I've given the file chmod 777. It's a standard PHP (move_uploaded_file) script :/

till
27th July 2009, 13:01
Your problem is not the permissions of the upload script, your problem is that the upload script sets wrong permissions for the uploaded image file. Your upload script must contain a chmod command to set the permissions of the uploadedc image file correctly.

Thomas Jensen
27th July 2009, 13:02
Okay, I've never done that before, why is it suddenly required? And how do i do it?
thanks

Thomas Jensen
29th July 2009, 23:54
I've changed to modPHP and now everything seems to work fine. But it still bothers me why it won't automatically do the file permissions in suPHP..

Thomas Jensen
30th July 2009, 00:05
I found the solution!

This bug: http://bugtracker.ispconfig.org/index.php?do=details&task_id=813&string=&project=3&due[0]=27&status[0]=closed
Was the one causing me the trouble.

Thanks to an always helpfull Till.

Offtopic: When i update my ISPConfig installation, which config files are overwritten? suphp.conf?, apache2.conf? the sites-default/ files?

till
30th July 2009, 09:10
Offtopic: When i update my ISPConfig installation, which config files are overwritten? suphp.conf?, apache2.conf? the sites-default/ files?

If you select to overwrite the config files during setup then all config files that had been configured during initial setup will be overwritten.