Re: [PHP-INSTALL] (ubuntu hardy) php5 and php4 both together - cli ok - apache2 segfaults..

[email protected] (Keith Roberts)
Newsgroups php.install
Message-ID <[email protected]>
On Tue, 16 Dec 2008, Morgan Cox wrote:

> To: [email protected]
> From: Morgan Cox <[email protected]>
> Subject: [PHP-INSTALL] (ubuntu hardy) php5 and php4 both together - cli ok -
>     apache2 segfaults..
> 
> Hi.
>
> I have just compiled the latest php4 on an ubuntu Plesk hardy server.
>
> It already had the distro's version of PHP - (PHP 5.2.4-2ubuntu5.4 with
> Suhosin-Patch 0.9.6.2), I installed PHP4 from source.
>
> The idea being so that if apache calls a .php5 page it gets parsed by php5 -
> normal .php pages to go to php4.
>
> It compiles fine and can run both from command line.
>
> Also I can run either of them fine - i,e php4 OR php5 - however as soon as I
> load BOTH modules (i.e no extra configuration) I get a segfault.
>
> i.e loading any ONE php module is fine........
>
> cli output:-
>
> php5 :
> php -v
> PHP 5.2.4-2ubuntu5.4 with Suhosin-Patch 0.9.6.2 (cli) (built: Nov 25 2008
> 22:10:31)
> Copyright (c) 1997-2007 The PHP Group
> Zend Engine v2.2.0, Copyright (c) 1998-2007 Zend Technologies
>
> php4  :
> usr/local/bin/php -v
> PHP 4.4.9 (cli) (built: Dec 16 2008 15:25:01)
> Copyright (c) 1997-2008 The PHP Group
> Zend Engine v1.3.0, Copyright (c) 1998-2004 Zend Technologies
>
>
> I get this in apache's error log
>
> [Tue Dec 16 15:50:22 2008] [notice] Apache/2.2.8 (Ubuntu) mod_python/3.3.1
> Python/2.5.2 PHP/5.2.4-2ubuntu5.4 with Suhosin-Patch mod_ssl/2.2.8
> OpenSSL/0.9.8g PHP/4.4.9 mod_perl/2.0.3 Perl/v5.8.8 configured -- resuming
> normal operations
> [Tue Dec 16 15:50:28 2008] [notice] child pid 1611 exit signal Segmentation
> fault (11)
>
>
> I complied php4 with
>
> ./configure  --prefix=/usr/local --sysconfdir=/etc/php4
> --with-config-file-path=/etc/php4
> --with-config-file-scan-dir=/etc/php4/php.d --with-pic --with-pear
> --with-bz2 --with-curl=/usr/include/ --with-freetype-dir=/usr
> --with-png-dir=/usr --enable-gd-native-ttf --with-gdbm --with-gettext
> --with-jpeg-dir=/usr --with-gmp --with-openssl=/usr --with-png-dir --with-gd
> --with-libexpat-dir=/usr/ --with-zlib --with-layout=GNU --enable-exif
> --enable-magic-quotes --enable-sockets --enable-sysvsem --enable-sysvshm
> --enable-calendar --with-apxs2=/usr/bin/apxs2 --with-gd
> --with-libxml-dir=/usr/include/libxml2 --enable-zip --enable-bcmath
> -with-gdbm --with-mcrypt=/usr/ --enable-shared --disable-ipv6 --with-imap
> --with-imap-ssl --with-kerberos --enable-zip --enable-dba
> --enable-mime-magic --enable-ctype --with-system-tzdata --enable-soap
> --enable-ftp --enable-mbstring --enable-zend-multibyte --with-mysql=/usr
> --enable-sysvmsg --with-layout=GNU --disable-rpath --enable-shmop
> --with-exec-dir=/usr/lib/php4/libexec --with-iconv --enable-wddx
> --enable-dbx
>
> I load the modules with
>
> LoadModule php4_module /usr/lib/apache2/modules/libphp4.so
> LoadModule php5_module /usr/lib/apache2/modules/libphp5.so
>
>
> Has anyone got any ideas how to stop apache segfaulting - i.e is it simply
> some config or do i need to recompile ? As previously mentioned php4 and
> php5 work 100% o.k seperately

This link might help you:

http://www.php.net/manual/en/faq.migration5.php

"You can run PHP4 and PHP5 as Apache2 modules at the same 
time. The trick is to hack the sources a little bit.
Change all occurences of application/x-httpd-php (and MIME 
type for sources) to application/x-httpd-php5 and then add 
that mime type to apache conf."

You could also use php5 to parse php4 code;

"The main change in PHP 5 is to the OOP model as PHP 5 now 
uses the Zend Engine 2.0. The  zend.ze1_compatibility_mode 
directive enables compatability with the Zend Engine 1.0 
(PHP 4)"

HTH

Keith Roberts


-----------------------------------------------------------------
Websites:
http://www.php-debuggers.net
http://www.karsites.net
http://www.raised-from-the-dead.org.uk

All email addresses are challenge-response protected with
TMDA [http://tmda.net]
-----------------------------------------------------------------
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.