|
|||
|
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 |
|
|||
|
You can request a trial CPanel server from www.cpanel.net and that will allow you to setup the server exactly like your hosts.
|
|
|||
|
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 |
|
|||
|
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.
|
|
|||
|
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! |
|
|||
|
Quote:
|
|
|||
|
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! |
![]() |
| Thread Tools | |
| Display Modes | |
|
|