#1  
Old 26th March 2009, 19:47
AdrianSmithUK AdrianSmithUK is offline
Junior Member
 
Join Date: Mar 2009
Posts: 14
Thanks: 1
Thanked 0 Times in 0 Posts
Default PHP Uploader Fails to Stream

Hello

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

Shows:

web10:x:10010:admispconfig,web10_admin,apache

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
London
Reply With Quote
Sponsored Links
  #2  
Old 27th March 2009, 12:25
till till is online now
Super Moderator
 
Join Date: Apr 2005
Location: Lüneburg, Germany
Posts: 36,054
Thanks: 826
Thanked 5,391 Times in 4,236 Posts
Default

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:

http://www.howtoforge.com/install-su...2.20-and-above

Please be aware that suphp is slower then the mod_php that you currently use.
__________________
Till Brehm
--
Get ISPConfig support and the ISPConfig 3 manual from ispconfig.org.
Reply With Quote
  #3  
Old 27th March 2009, 13:01
AdrianSmithUK AdrianSmithUK is offline
Junior Member
 
Join Date: Mar 2009
Posts: 14
Thanks: 1
Thanked 0 Times in 0 Posts
Default 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
Reply With Quote
  #4  
Old 27th March 2009, 13:06
till till is online now
Super Moderator
 
Join Date: Apr 2005
Location: Lüneburg, Germany
Posts: 36,054
Thanks: 826
Thanked 5,391 Times in 4,236 Posts
Default

Quote:
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.
__________________
Till Brehm
--
Get ISPConfig support and the ISPConfig 3 manual from ispconfig.org.
Reply With Quote
  #5  
Old 27th March 2009, 13:27
AdrianSmithUK AdrianSmithUK is offline
Junior Member
 
Join Date: Mar 2009
Posts: 14
Thanks: 1
Thanked 0 Times in 0 Posts
Default Fixed It!

Hurray!!!

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

Before:

apache:x:48:apache

After:

apache:x:48:apache,web10_admin

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

Before:

web10:x:10010:admispconfig,web10_admin

After

web10:x:10010:admispconfig,web10_admin,apache

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
Reply With Quote
  #6  
Old 1st April 2009, 02:09
wapa17 wapa17 is offline
Junior Member
 
Join Date: Jan 2007
Posts: 28
Thanks: 2
Thanked 3 Times in 3 Posts
Thumbs up

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 !
Reply With Quote
Reply

Bookmarks

Tags
group, ownerships, php, upload

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
ffmpeg Video support for ubuntu 7.10 [suphp-ispconfig] amaurib Installation/Configuration 13 16th February 2010 17:26
ISP Config hesitation when opening web pages frankb Installation/Configuration 7 15th December 2008 13:06
Improve the Firewall rules vaio1 Installation/Configuration 0 10th May 2008 20:44
ispconfig php 5 errors itamarjp Installation/Configuration 8 25th April 2008 10:20
Apache2 Freezes celtic Server Operation 31 28th May 2007 17:18


All times are GMT +2. The time now is 10:35.


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