This step-by-step guide explains how to set up PHP in the standalone mode.
Step 1. Download PHP src (any), extract src archive.
Step 2. Compile and install standalone PHP:
./configure --prefix=/hsphere/shared/apache/php \
--with-zlib-dir \
--with-jpeg-dir \
--with-png-dir \
--with-gd=/hsphere/shared \
--with-mysql=/usr \
--with-gettext \
--disable-debug \
--enable-versioning \
--enable-sockets \
--enable-track-vars \
--with-pgsql=/usr \
--enable-ftp \
--localstatedir=/var/hsphere/php && make && make install
You can add other options, too. Mind that
in php starting version 4.3.0 php comes bundled with its own GD library,
and if you want to use it, replace
--with-gd=/hsphere/shared \
with
--with-gd \
Step 3. Add to /hsphere/local/config/httpd/httpd.conf :
AddType application/x-httpd-php-external .php4 .phpext
Action application/x-httpd-php-external "/php/bin/php"
#.php4, .phpext - extensions for scripts executed with external php as a user
<Directory /hsphere/shared/apache/php/bin>
Options +ExecCGI
</Directory>
ScriptAlias /php/bin/ /hsphere/shared/apache/php/bin/
Step 4. Without make install, download, extract and recompile apache suexec with --suexec-docroot=/hsphere:
===suexec.patch===
--- src/support/suexec.c.orig Thu Mar 8 20:11:43 2001
+++ src/support/suexec.c Wed Jun 19 23:04:41 2002
@@ -556,21 +556,6 @@
}
/*
- * Error out if the target name/group is different from
- * the name/group of the cwd or the program.
- */
- if ((uid != dir_info.st_uid) ||
- (gid != dir_info.st_gid) ||
- (uid != prg_info.st_uid) ||
- (gid != prg_info.st_gid)) {
- log_err("error: target uid/gid (%ld/%ld) mismatch "
- "with directory (%ld/%ld) or program (%ld/%ld)\n",
- uid, gid,
- dir_info.st_uid, dir_info.st_gid,
- prg_info.st_uid, prg_info.st_gid);
- exit(120);
- }
- /*
* Error out if the program is not executable for the user.
* Otherwise, she won't find any error in the logs except for
* "[error] Premature end of script headers: ..."
==================
patch -p0 < suexec.patch
./configure --prefix=/hsphere/shared/apache \
--server-uid=httpd \
--server-gid=httpd \
--sysconfdir=/hsphere/local/config/httpd \
--enable-suexec \
--localstatedir=/hsphere/local/var/httpd \
--suexec-logfile=/hsphere/local/var/httpd/logs/suexec_log \
--suexec-caller=httpd \
--suexec-docroot=/hsphere \
--enable-module=most \
--enable-shared=remain && make
and place new suexec binary to apache web server:
cp -f src/support/suexec /hsphere/shared/apache/bin/ && chmod 4711 /hsphere/shared/apache/bin/suexec
Step 5. Execute /hsphere/shared/apache/bin/apachectl configtest
and ensure there are no errors in the config file. Then execute the following commands:
/hsphere/shared/apache/bin/apachectl stop
/hsphere/shared/apache/bin/apachectl startssl
|