Forum Moderators: coopster
Everythng works alright on the development server. Once online, i knew i had to set the picture's directory to 755 (for security reasons)... bad news is, in the moment a user uploads a picture, it has to be temporary set to 777. This is what im using:
...
@chmod($dir,0777);
imageJPEG($temp,$dir.$id.'.jpg',90);
@chmod($dir,0755);
...
Where:
$dir is the directory that holds the pictures
$temp,$dir.$id.'.jpg' could be $dir/745.jpg
Is there a better way?
suExec provides Apache users the ability to run CGI and SSI programs under user IDs different from the user ID of the calling web-server. Normally, when a CGI or SSI program executes, it runs as the same user who is running the web server.
suPHP is a tool for executing PHP scripts with the permissions of their owners. It consists of an Apache module (mod_suphp) and a setuid root binary (suphp) that is called by the Apache module to change the uid of the process executing the PHP interpreter.
What management software is on your dedicated server? cPanel Plesk Directadmin?
So for an example I create a hosting account with a username of example all scripts and files in example's home directory and webroot are owned by the username example.
so if I go to example.com/someScriptThatDoesStuff.php and it is performing an upload the resulting file will be owned by example so it does not have to be world writable. I hope that makes sense.
I am not that familiar with Plesk. I would imagin there are some good tutorials on setting Apache up to utilize the security features maybe in the Plesk Forum but I am not sure.
Good luck