#1 (permalink)  
Old 01-17-2006, 07:33 AM
Registered User
 
Join Date: Jan 2006
Posts: 7
bravado is on a distinguished road
phpsuexec patch for Apache

My hosting provider uses cPanel and, more specifically, uses the phpsuexec patch to run PHP on Apache. I'm in the process of re-compiling Apache and PHP on my little production server for testing. However, the suexec php patches I've found don't appear to work right with Apache 1.3.34. So...what I was wondering is if it's possible someone could post or e-mail me a copy of the phpsuexec patch that cPanel uses for Apache 1.3.34.

Thanks in advance!

Jeff Whitfield
jeffwhitfield@gmail.com
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 01-17-2006, 09:15 AM
Registered User
 
Join Date: Apr 2003
Location: Lewisville, Tx
Posts: 966
kris1351
You can request a trial CPanel server from www.cpanel.net and that will allow you to setup the server exactly like your hosts.
__________________
Kris
NCServ, LLC.
WebHosting - Dedicated Servers - Colocation
sales@ncerv.com
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 01-17-2006, 01:30 PM
Registered User
 
Join Date: Jan 2006
Posts: 7
bravado is on a distinguished road
Ok...I've installed Apache with the following patches from the cPanel trial I downloaded:

apache_1.3.34-php-suexec-patch
suexec+php-httpusergroupallow.patch

The configure lines I used for Apache and PHP are as follows:

PHP:

./configure --prefix=/usr --with-xml --enable-bcmath --enable-calendar --with-curl --with-dom --with-dom-xslt --with-dom-exslt --enable-exif --enable-ftp --with-gd --with-jpeg-dir=/usr/local --with-png-dir=/usr --with-xpm-dir=/usr/X11R6 --with-gettext --with-kerberos --enable-mbstring --enable-mbstr-enc-trans --enable-mbregex --with-mcrypt --with-mhash --enable-magic-quotes --with-mysqli --with-mysql=/usr --enable-discard-path --with-pear --enable-xslt --with-xslt-sablot --enable-sockets --enable-track-vars --with-ttf --with-freetype-dir=/usr --enable-gd-native-ttf --enable-versioning --enable-wddx --with-xmlrpc --with-zip --with-zlib --with-iconv=/usr/local

Apache:

./configure --with-layout=Apache --enable-module=expires --enable-shared=expires --enable-suexecphp --enable-module=rewrite --enable-shared=rewrite --enable-suexec --suexec-logfile=/usr/local/apache/logs/suexeclog --suexec-caller=nobody --suexec-uidmin=100 --suexec-gidmin=100 --suexec-docroot=/ --suexec-userdir=public_html

I changed the httpd.conf file by adding ExecCGI to my root Apache htdocs directory and added the following line at the bottom:

AddHandler application/x-httpd-php .php .php4 .php3

Then I copied a simple phpinfo.php page to my htdocs folder, CHMOD'ed it to 755, and attempted to view it but got a 500 Internal Error instead with the following in my Apache error log:

[Tue Jan 17 13:10:43 2006] [notice] Apache/1.3.34 (Unix) PHP-CGI/0.1b configured -- resuming normal operations
[Tue Jan 17 13:10:43 2006] [notice] suEXEC mechanism enabled (wrapper: /usr/local/apache/bin/suexec)
[Tue Jan 17 13:10:43 2006] [notice] Accept mutex: sysvsem (Default: sysvsem)
[Tue Jan 17 13:11:15 2006] [error] [client 70.251.37.66] File does not exist: /usr/local/apache/htdocs/favicon.ico
[Tue Jan 17 13:11:21 2006] [error] (8)Exec format error: exec of /usr/local/apache/htdocs/phpinfo.php failed
[Tue Jan 17 13:11:21 2006] [error] [client 70.251.37.66] Premature end of script headers: /usr/local/apache/htdocs/phpinfo.php

So...I guess I'm wondering where the problem lies. I'm lost! All I really want to do is get Apache and PHP configured so that it mimics a similar configuration to what cPanel uses. My hosting provider uses the phpsuexec methods so I really need to get this working...else I won't have a properly configured test server. Ugg! What a headache! LOL!

Thanks in advance!

Jeff
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 01-17-2006, 01:54 PM
sawbuck's Avatar
Registered User
 
Join Date: Jan 2004
Posts: 1,272
sawbuck is on a distinguished road
Set the permissions on phpinfo.php to 644.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 01-17-2006, 02:41 PM
Registered User
 
Join Date: Jan 2006
Posts: 7
bravado is on a distinguished road
Quote:
Originally Posted by sawbuck
Set the permissions on phpinfo.php to 644.
Nope! That didn't do it! Hmm....
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #6 (permalink)  
Old 01-17-2006, 03:09 PM
Registered User
 
Join Date: Jan 2006
Posts: 7
bravado is on a distinguished road
Well...Apache is set to run with the user/group of 'nobody'. I tried setting the ownership of the phpinfo.php file to something like wwwrun:users but still get the error. I know that you can't have the ownership set to root so no problem there. Hmm...I seem to be missing something somewhere in terms of permission settings.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #7 (permalink)  
Old 01-17-2006, 04:12 PM
sawbuck's Avatar
Registered User
 
Join Date: Jan 2004
Posts: 1,272
sawbuck is on a distinguished road
Might have lead you astray as I have had apache safe_mode on the brain lately.

Max perms would be 755 but normally 644 should work. Also files and directories should be owned user/group.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #8 (permalink)  
Old 01-17-2006, 04:33 PM
Registered User
 
Join Date: Jan 2006
Posts: 7
bravado is on a distinguished road
According to what I've read, since I compiled Apache to use a user/group id of 100 then that would mean that so long as the file being executed has a user/group id that is 100 or below then Apache will allow it to be executed. Apache itself is set to run as user/group 'nobody'...but I'm not sure how much bearing this has on suexec settings. So long as I can get PHP to work in my main htdoc directory and any subdirectory below it, I'll be fine. But for now, this is getting tricky!

One thing I notice, and I can't believe I didn't think of this, is that the PHP executable seemed to be one I used previously. I did the following on the command line:

php -v

and ended up with some info that told me I was running version 4.3.10 instead of 4.4.1. So...I removed every instance of PHP and reinstalled it. First thing after I did that I repeated the same command. This time, I got an error telling me that /usr/local/bin/php didn't exist. Strange. So I copied the binary from /usr/bin to /usr/local/bin and all appears fine from the command line so PHP is the right version now...but still a no-go! ARGG! Man...this phpsuexec stuff is frustrating! LOL!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #9 (permalink)  
Old 01-17-2006, 07:19 PM
PDM PDM is offline
Registered User
 
Join Date: Jan 2004
Location: Angel Fire, NM
Posts: 41
PDM
Make sure you don't have a .htaccess in that folder with php commands in it.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #10 (permalink)  
Old 01-17-2006, 09:34 PM
Registered User
 
Join Date: Jan 2006
Posts: 7
bravado is on a distinguished road
Quote:
Originally Posted by PDM
Make sure you don't have a .htaccess in that folder with php commands in it.
One step ahead of ya! We're talkin' a plain-Jane install with nothing but the default index.html in the htdocs folder...nothing to get in the way.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #11 (permalink)  
Old 01-18-2006, 09:39 AM
Registered User
 
Join Date: Jan 2006
Posts: 7
bravado is on a distinguished road
A little update on my progress. I decided to rebuild Apache with the following config line:

./configure --with-layout=Apache --enable-module=expires --enable-shared=expires --enable-suexecphp --enable-module=rewrite --enable-shared=rewrite --enable-suexec --suexec-logfile=/usr/local/apache/logs/suexeclog --suexec-caller=apache --suexec-uidmin=50 --suexec-gidmin=50 --datadir=/home/apache --suexec-userdir=public_html

Before that though I created a new user/group called 'apache' with a user/group id of 50. I figured that part of my problem might be related to user rights. Before configuring and installing Apache, I applied the same patches as before (apache_1.3.34-php-suexec-patch and suexec+php-httpusergroupallow.patch). After the install, I updated the httpd.conf file to use the new 'apache' user when running the daemon. I then chown'ed everything in the /home/apache directory to apache:apache so the user that owns the suexec call is the same. Placed a phpinfo.php file in the htdocs, changed the ownership and permissions, and attempted to view the file....same error! (8)Exec format error.

Sigh! This PHPSuExec stuff is for the birds! LOL! I'm missing something somewhere!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply

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 Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -5. The time now is 12:59 PM.


Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
© cPanel Inc