Go Back   HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials > ISPConfig 2 > General

Do you like HowtoForge? Please consider supporting us by becoming a subscriber.
Reply
 
Thread Tools Display Modes
  #1  
Old 4th May 2007, 12:54
rad rad is offline
Junior Member
 
Join Date: May 2007
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Question uploaded files owned by apache

Hello everyone .
I have just installed ispConfig on Centos 4.4 server ( I followed exactly the tutorial in this site ) .
eveything works fine . just when I uploade a file via php the owener and the groupe of the uploaded file is apache not the script owner r .

[root@ns1 uploads]# ls -alt
total 156
drwxrwxrwx 2 web1_username web1 4096 May 4 14:36 .
-rw------- 1 apache apache 143476 May 4 14:36 settings.jpg
drwxrwxrwx 4 web1_username web1 4096 May 4 14:35 ..
[root@ns1 uploads]#

can someone help please .

below is the php file
<?php

$uploaddir = '/var/www/web1/web/uploads/';
$uploadfile = $uploaddir . basename($_FILES['userfile']['name']);

echo "<p>";

if (move_uploaded_file($_FILES['userfile']['tmp_name'], $uploadfile)) {
echo "File is valid, and was successfully uploaded.\n";
} else {
echo "Upload failed";
}

echo "</p>";
echo '<pre>';
echo 'Here is some more debugging info:';
print_r($_FILES);
print "</pre>";

?>
Reply With Quote
Sponsored Links
  #2  
Old 4th May 2007, 16:49
till till is online now
Super Moderator
 
Join Date: Apr 2005
Location: Lüneburg, Germany
Posts: 35,990
Thanks: 825
Thanked 5,373 Times in 4,220 Posts
Default

A uploaded script is always owned by the user that runs the script, in your case is the script run by the apache user. If you want your script to be owned by the admin user of the website, you will have to run your php scripts with e.g. SuPHP and not mod_php.
__________________
Till Brehm
--
Get ISPConfig support and the ISPConfig 3 manual from ispconfig.org.
Reply With Quote
  #3  
Old 4th May 2007, 21:57
rad rad is offline
Junior Member
 
Join Date: May 2007
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I see that suexec is installed and working isn't enough , do I need to install suPHP as well ? and if so what modifications I need to do ? Can you please guide me in details as I'm new to Linux as well .
Thank you very much
Reply With Quote
  #4  
Old 4th May 2007, 23:16
Hans Hans is offline
Moderator
 
Join Date: Dec 2005
Location: Montfoort, The Netherlands
Posts: 2,256
Thanks: 212
Thanked 648 Times in 294 Posts
Default

Hi,

I want you to know that you will not able to run suPHP AND suexec as well, because suPHP is not compatible with suexec. For this reason do not run those together.

To give you an idea how you can setup suPHP on an ISPConfig server, you can have a look here: http://www.howtoforge.com/suphp_debian_etch_ispconfig

The howto is written for Debian Etch but with some modifications, you're able to use the setup for your Linux distribution as well.
__________________
Hans

MrHostman | Master in managed hosting
Reply With Quote
  #5  
Old 4th May 2007, 23:38
rad rad is offline
Junior Member
 
Join Date: May 2007
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

is suexec not enough to handel this issue ? also If I'm going to remove suexec am I going to have problems with ISPconfig or with other scripts ( cgi , Perl script )

Thanks
Reply With Quote
  #6  
Old 5th May 2007, 13:14
till till is online now
Super Moderator
 
Join Date: Apr 2005
Location: Lüneburg, Germany
Posts: 35,990
Thanks: 825
Thanked 5,373 Times in 4,220 Posts
Default

You may handle this with SuEXEC + PHP as cgi too. But then you will have to add the PHP-CGI action definition and addhandler lines to the apache directives field of the website.

1) Install php as cgi.

2)Add these lines in the apache directives field of the website:

Action php-cgi /cgi-bin/php
AddHandler php-cgi .php

and make sure that the php, php-safemode and cgi checkboxes are not enabled in the website.

Quote:
also If I'm going to remove suexec am I going to have problems with ISPconfig or with other scripts ( cgi , Perl script )
No, beacuse SuPHP replaces the suexec functionality of other cgi scripts too.
__________________
Till Brehm
--
Get ISPConfig support and the ISPConfig 3 manual from ispconfig.org.
Reply With Quote
  #7  
Old 5th May 2007, 14:09
rad rad is offline
Junior Member
 
Join Date: May 2007
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thank you for your reply ,
I have used yum to install php as in this tutorial http://www.howtoforge.com/perfect_setup_centos_4.4 ,
My understanding is that, yum did not install php as cgi script . ( If I'm wrong please correct for me as I'm only 4 weeks old in Linux world ) . So I have to remove PHP ( yum remove * PHP* ) which will remove the following

php i386 4.3.9-3.22.4 installed 3.2 M
php-devel i386 4.3.9-3.22.4 installed 920 k
php-gd i386 4.3.9-3.22.4 installed 286 k
php-imap i386 4.3.9-3.22.4 installed 83 k
php-ldap i386 4.3.9-3.22.4 installed 39 k
php-mysql i386 4.3.9-3.22.4 installed 40 k
php-odbc i386 4.3.9-3.22.4 installed 55 k
php-pear i386 4.3.9-3.22.4 installed 1.2 M
php-xmlrpc i386 4.3.9-3.22.4 installed 72 k

then I have to get the source code from www.PHP.net and compile it .and install it . ( and aging if I'm wrong please correct for me ).
I'll use this command ./configure --without-apache --without-apxs --with-other-options then make && make install

The question now , What about Mysql , apache , and ISPconfig are they going to work fine or do I have to reinstall all of them .
Thank you again for your help

Last edited by rad; 5th May 2007 at 14:13.
Reply With Quote
  #8  
Old 5th May 2007, 20:18
till till is online now
Super Moderator
 
Join Date: Apr 2005
Location: Lüneburg, Germany
Posts: 35,990
Thanks: 825
Thanked 5,373 Times in 4,220 Posts
 
Default

You dont have to remove PHP, php as module is fine for many applications and much faster the php as cgi. I recommend to install php as cgi beside your current php installation, so you can switch between the two different php installs.
__________________
Till Brehm
--
Get ISPConfig support and the ISPConfig 3 manual from ispconfig.org.
Reply With Quote
Reply

Bookmarks

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
apache - php files wont run warmo1 Installation/Configuration 4 10th March 2007 11:39
Network questions regarding Ubuntu Server lubod Installation/Configuration 7 3rd January 2007 18:53
Centos 4.4 32bit Hangs, High Server load 3cwired_com Server Operation 11 16th November 2006 15:47
Problem with the installation of Dokeos (LMS) in ISPConfig jofranco General 4 28th April 2006 00:45
New Site Shows Apache Default page not uploaded index.html mojosound Installation/Configuration 35 18th April 2006 10:59


All times are GMT +2. The time now is 14:04.


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