Community Forums
Connect with us on LinkedIn
Community Notice
+ Reply to Thread
Results 1 to 11 of 11
  1. #1
    Member
    Join Date
    Jan 2006
    Posts
    7

    Default 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

  2. #2
    Member
    Join Date
    Apr 2003
    Location
    Lewisville, Tx
    Posts
    968

    Default

    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

  3. #3
    Member
    Join Date
    Jan 2006
    Posts
    7

    Default

    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

  4. #4
    Member sawbuck's Avatar
    Join Date
    Jan 2004
    Posts
    1,310
    cPanel/Enkompass Access Level

    Root Administrator

    Default

    Set the permissions on phpinfo.php to 644.

  5. #5
    Member
    Join Date
    Jan 2006
    Posts
    7

    Default

    Quote Originally Posted by sawbuck
    Set the permissions on phpinfo.php to 644.
    Nope! That didn't do it! Hmm....

  6. #6
    Member
    Join Date
    Jan 2006
    Posts
    7

    Default

    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.

  7. #7
    Member sawbuck's Avatar
    Join Date
    Jan 2004
    Posts
    1,310
    cPanel/Enkompass Access Level

    Root Administrator

    Default

    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.

  8. #8
    Member
    Join Date
    Jan 2006
    Posts
    7

    Default

    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!

  9. #9
    PDM
    PDM is offline
    Member
    Join Date
    Jan 2004
    Location
    Angel Fire, NM
    Posts
    43

    Default

    Make sure you don't have a .htaccess in that folder with php commands in it.

  10. #10
    Member
    Join Date
    Jan 2006
    Posts
    7

    Default

    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.

  11. #11
    Member
    Join Date
    Jan 2006
    Posts
    7

    Default

    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!

Similar Threads & Tags
Similar threads

  1. Apache recompiled with PHPsuexec support
    By Bdzzld in forum cPanel and WHM Discussions
    Replies: 26
    Last Post: 01-24-2009, 05:26 AM
  2. Apache 1.3.37 with PHPSuExec
    By asterisk in forum cPanel and WHM Discussions
    Replies: 1
    Last Post: 10-27-2006, 05:17 AM
  3. phpsuexec + apache installation guide
    By shann in forum cPanel and WHM Discussions
    Replies: 6
    Last Post: 03-18-2006, 02:11 PM
  4. Apache Patch Error?
    By mcenetwork in forum cPanel and WHM Discussions
    Replies: 1
    Last Post: 05-30-2005, 05:18 AM
  5. 01 Apr buildapache and phpsuexec (apache fails)
    By Radio_Head in forum cPanel and WHM Discussions
    Replies: 1
    Last Post: 04-01-2003, 06:45 AM
Linkedin       Facebook       Twitter       RSS       Flickr       YouTube