PHP Uploader Fails to Stream

Discussion in 'Installation/Configuration' started by AdrianSmithUK, Mar 26, 2009.

  1. AdrianSmithUK

    AdrianSmithUK New Member


    About a month ago projektfarm kindly setup ispConfig v2.7 on my CentOS5.2 server. (Which was well worth the money!!!)

    I am now working on a project where I need to use PHP scripts to:

    1. Create / Delete temporary .csv files using PHP commands.
    2. Upload .csv files to the server

    With the default ownership settings (web10_admin:web10) I currently get an error when I try creating/ deleting/ uploading files.
    Warning: copy(/home/www/web10/web/test/uploadsdigreadout11.jpg) [function.copy]: failed to open stream: Permission denied in /home/www/web10/web/test/uploads/uploader.php on line 6
    Could not copy file

    I have found a partial solution by changing the ownerships as follows:

    # chown -R -v -f apache:apache /home/www/web10/web/

    However, with the ownerships set to apache I can't administer the files via ftp. I get another error message saying that I don’t have permission.

    I guessed that I could add apache to the web10 group and that this would fix things. So I changed all of the files back to (web10_admin:web10) ownerships and added apache to the web10 group:

    # usermod -a -G apache,web10 apache

    #vi etc/group



    However, the upload script still fails to stream. Same error as shown previously.

    All of the files and directories were chmod'ed to 775.

    Does anybody know the solution?

    Kind Regards,

    Adrian Smith
  2. till

    till Super Moderator Staff Member ISPConfig Developer

  3. AdrianSmithUK

    AdrianSmithUK New Member

    How do other ISPs do it?

    Hi Till

    Many thanks for the fast response but isn't there an easier solution?

    This is one of the most basic uses of PHP.

    suPHP is relatively new compared to mod_php and most shared server space is based on mod_php and yet ISP's configure their servers so that users can 1) delete files via an ftp client as well as 2) create/ delete/ edit/ upload files at run time via PHP/Apache.

    Isn't there a simple solution to do with combining the ftp/web_admin and apache groups?

    Kind Regards,

    Adrian Smith
  4. till

    till Super Moderator Staff Member ISPConfig Developer

    The only solution for ISPConfig 2 is suphp. mod_php does not support to run php under different users. But suphp is stable as well, but it is slower as it has to start a php cgi request for every incoming request.
  5. AdrianSmithUK

    AdrianSmithUK New Member

    Fixed It!


    I've fixed it myself. What a great feeling!!!

    Here is how you do it for anybody else who is having the problem.

    1. Edit your "group" file.

    #vi /etc/group

    2. Find the apache group info and add the website user to the group





    3. Find the website group (in my case web10) and add "apache" to the group.





    4. Save the file and exit.

    5. Restart Apache

    #apachectl graceful

    Now you can manipulate files via PHP or FTP.

    I hope this helps.

    Kind Regards,

    Adrian Smith
  6. wapa17

    wapa17 New Member

    thanks AdriansmithUK,

    ..this was the solution. Had a similar problem (Ispconfig with a website which needs to create directories and fileupload in this dirs - and all with HTTP, because the client don't like to handle FTP..

    Thanks again !

Share This Page