HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials

HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials (
-   Installation/Configuration (
-   -   PHP Uploader Fails to Stream (

AdrianSmithUK 26th March 2009 20:47

PHP Uploader Fails to Stream

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

till 27th March 2009 13:25

If you want that all files written by a php script are owned by the admin user of a website, you will have to switch to suphp:

Please be aware that suphp is slower then the mod_php that you currently use.

AdrianSmithUK 27th March 2009 14:01

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

till 27th March 2009 14:06


Isn't there a simple solution to do with combining the ftp/web_admin and apache groups?
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.

AdrianSmithUK 27th March 2009 14:27

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

wapa17 1st April 2009 03:09

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 !

All times are GMT +2. The time now is 21:32.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.