When i put a Dotclear Webblog or another CMS.. If i want upload a file via Php.. the file go on the right place but not with the owner of the site.. exemple webx_user. The file owner in the server is wwwrun www (apache).. How can i upload a file with php and have the right owner ? Thanks a lot..
If you don't run PHP in safe mode, you can execute shell commands. With Code: <?php $output = shell_exec("chown webx_user.webx filename"); echo $output; ?> you can for example make filename owned by webx_user in the group webx. Why do you want to do this though? Shouldn't the file be accessible by everyone after uploading? You wont be able to access the file with the user permissions of webx_user via PHP this way though. You should make sure the permissions are set to "chmod 666 filename" if it should be read/write accessible by everybody. Btw, I even use PHP for shell scripting this way, because I know it better than Bash. With a Code: #!/usr/bin/php <?php // code ?> and a Code: chmod +x scriptname you can just execute the script like any other shell script, if you have php installed. (Just a side remark)
Ok Thanks for your answer i have already think that but why in ovh or 1and1 it is ok ? When i upload a file via php, it is ok the owner of the file is the user and not owner of apache..and i don t need to make change to my php script ? It is a option of ISPconfig or Virtual host who block owner ?? can i do something with .htacess or option of Suexec ?? thanks
To run PHP with the permissions of the website owner instead of the apache user you must run PHP as CGI-PHP with SuExec, SuPHP or PHP as FastCGI. This is a question how you setup PHP and not ISPConfig as the PHP that runs on your webserver is not part of the ISPconfig package, it belongs to your linux distribution. To setup PHP with SuPHP, have a look here: http://www.howtoforge.com/apache2_suphp_php4_php5