Pb with Upload Php

Discussion in 'Tips/Tricks/Mods' started by matteo, Jun 23, 2006.

  1. matteo

    matteo New Member

    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..
  2. geek.de.nz

    geek.de.nz New Member

    If you don't run PHP in safe mode, you can execute shell commands.
      $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
    and a
    chmod +x scriptname
    you can just execute the script like any other shell script, if you have php installed. (Just a side remark)
  3. matteo

    matteo New Member


    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 ??

  4. till

    till Super Moderator Staff Member ISPConfig Developer

    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:

  5. matteo

    matteo New Member

    Thanks a lot

    thanks of lot for you contrib..

Share This Page