I ran into so many problems trying to set this up that I thought I'd
post my notes to hopefully save others some trouble.

I found most of the information I needed at:
http://rayh.co.uk/archives/13_PHP5__PHP4_side_by_side.html
but the link doesn't seem to be working anymore, so here are my notes.

Versions:
PHP4.x module (already compiled and installed, this was
straightforward in docs at www.php.net)
PHP5.0.0 cgi
RedHat linux 6.x
Apache 1.3.22

PHP5 configure command:
./configure \
        --prefix=/usr/local/php/php5.0.0 \
        --with-config-file-path=/usr/local/php/php5.0.0/ \
        --with-config-file=/usr/local/php/php5.0.0/php.ini \
        --enable-force-cgi-redirect \
        --disable-path-info-check \
        --enable-safe-mode \
        --disable-short-tags \
        --with-regex=system \
        --with-mysql \
        --enable-debug \
        --with-mcrypt \
        --enable-versioning \
        --disable-libxml

NOTE: when I enabled '--enable-discard-path', pages would load blank.
Don't use this unless you know what you are doing.  I don't understand
exactly what this does.

NOTE: The options '--with-apxs' and '--with-apache' tell configure to
build apache module and CLI.  The absence of these tells it to build
the CGI version.  So DO NOT USE them if you want the CGI version.

make
make test
make install


Add the following to httpd.conf (must be in the generic server
settings, NOT in a virtual host):
ScriptAlias /cgi-php5/ "/usr/local/php/php5.0.0/bin/"
<Directory "/usr/local/php/php5.0.0/bin/">
        Options +ExecCGI
        Allow From All
</Directory>


Foreach virtual host you want to use php5 on:
Create a directory named 'cgi-php5' one level above the document root.
This will most likely be in the same directory that has the cgi-bin
directory in it.


Foreach directory that you want to us php5 for:
Add the following to .htaccess file (or virtual host inside a
Directory container):
Action php5-script /cgi-php5/php
AddHandler php5-script .php
Options +ExecCGI

This is an excellent solution because:
 - You only have to restart apache once.  After that, you can add
.htaccess files to enable php5 interpretation whereever you want.
 - You can upgrade/downgrade php5 without touching apache.
 - You don't have clunky file extensions like .php5 or anything else
that will be difficult to change later on down the road.

PROBLEMS: So far, I cannot figure out why $_POST is empty when an html
form is sent with method=post.  GET works fine.  In all my searching,
I think it has something to do with how apache is setup; not with how
php is configured.  I've tried the default php-dist ini file, I've tried
many different variations of php configure commands.  None of them do
the trick.  PHP bug list has some posts from people with the same problem
and then they said they found a problem in apache setup that fixed it.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to