Using php3 and php4 as concurrent Apache Modules

Apache, Lighttpd, nginx, Cherokee
Post Reply
gnome_x
Posts: 13
Joined: 2002-07-15 04:50
Location: Bonn/Köln
 

Using php3 and php4 as concurrent Apache Modules

Post by gnome_x »

I am trying to install php3 and php4 as concurrent apache modules on a 1und1 root-server XXL, runing on Suse 8.1 and confix 2.

I am doing this because I need to mantian backwards compatibility for a Site writen in php3, that uses "register_session", which is no longer available after php 4.0.6.

In the server is installed apache 1.3.26 and php 4.2.2

The PHP documentation gives these instructions on using php3 and php4 as concurrent apache modules:

Code: Select all

   With some (newer) installations of Apache, it's possible to compile both
   PHP 3 and PHP 4, and run them concurrently. 

   Note, it's only really wise to do this if you need to use the PHP 3 engine
   to maintain backwards compatibility. 
   
   To enable it, configure PHP 3 and PHP 4 to use APXS (--with-apxs) and the  necessary link extensions (--enable-versioning). Otherwise, all standard installations instructions apply. For example:

$ ./configure 
--with-apxs=/apache/bin/apxs 
--enable-versioning 
--with-mysql 
When I run phpinfo(), I can see that PHP 4.2.2 is configured as below, including the three reguired points above:

Code: Select all

'./configure' '--prefix=/usr/share' '--datadir=/usr/share/php' '--bindir=/usr/bin' '--libdir=/usr/share' '--includedir=/usr/include' '--with-_lib=lib' '--with-config-file-path=/etc' '--with-exec-dir=/usr/lib/php/bin' '--disable-debug' '--enable-bcmath' '--enable-calendar' '--enable-ctype' '--enable-dbase' '--enable-discard-path' '--enable-exif' '--enable-filepro' '--enable-force-cgi-redirect' '--enable-ftp' '--enable-gd-imgstrttf' '--enable-gd-native-ttf' '--enable-inline-optimization' '--enable-magic-quotes' '--enable-mbstr-enc-trans' '--enable-mbstring' '--enable-memory-limit' '--enable-safe-mode' '--enable-shmop' '--enable-sigchild' '--enable-sysvsem' '--enable-sysvshm' '--enable-track-vars' '--enable-trans-sid' '--enable-versioning' '--enable-wddx' '--enable-yp' '--with-bz2' '--with-dom=/usr/include/libxml2' '--with-ftp' '--with-gdbm' '--with-gettext' '--with-gmp' '--with-imap=yes' '--with-iodbc' '--with-jpeg-dir=/usr' '--with-ldap=yes' '--with-mcal=/usr' '--with-mcrypt' '--with-mysql=/usr' '--with-ndbm' '--with-pgsql=/usr' '--with-png-dir=/usr' '--with-qtdom=/usr/lib/qt2' '--with-snmp' '--with-t1lib' '--with-tiff-dir=/usr' '--with-ttf' '--with-freetype-dir=yes' '--with-xml' '--with-xpm-dir=/usr/X11R6' '--with-zlib=yes' '--with-gd=shared' '--with-openssl' '--with-curl' '--with-swf=./dist/' '--with-imap-ssl' '--enable-xslt' '--with-xslt-sablot' '--with-mm' '--with-apxs=/usr/sbin/apxs' 'i586-suse-linux'
This seems OK.

Now, when I try to install PHP 3.1.8, begining with configuring it with the 3 required options:

Code: Select all

./configure 
--enable-versioning 
--with-mysql 
--with-apxs=/usr/sbin/apxs   (I took the path from the PHP 4.2.2 Info, but when I look through shell, I can't find any files or directories called apxs in this directory, nore any other directory in the server when I search for it with: find / -name apxs)
I do get the following Warning:

Code: Select all

WARNING: Your /usr/sbin/apxs script is most likely broken.

Please go read http://www.php.net/FAQ.php3#6.11 and make the
changes described there and try again.
The problem here is that I can't find any apxs on my server, so I can make any changes.

- The path could be wrong(if so, what is php 4.2.2 using than? I have sites that are running on php 4.2.2 perfectly in the server),

- or apxs is not installed at all. (in this case how do I install it, without damaging anything else)

- or could there be something else that I'm doing wrong?

Thanx in forward
/gnome_x
gnome_x
Posts: 13
Joined: 2002-07-15 04:50
Location: Bonn/Köln
 

Re: Using php3 and php4 as concurrent Apache Modules

Post by gnome_x »

I just Installed apxs sucessfully by installing apache-devel. That is not a problem anymore.

QUESTION:

Should I install php3 as:

- Dynamic Shared Object
- or Static Object (requires Apache to recompile, and I'm afarid that I will be destroying anything, and php 4.2.2 will not work any more)
jamesb
Posts: 661
Joined: 2002-05-08 15:35
Location: Karlsruhe
Contact:
 

Re: Using php3 and php4 as concurrent Apache Modules

Post by jamesb »

Install it as DSO, it's more flexible.

JamesB
gnome_x
Posts: 13
Joined: 2002-07-15 04:50
Location: Bonn/Köln
 

Re: Using php3 and php4 as concurrent Apache Modules

Post by gnome_x »

Installed it with DSO, but it gave some mistakes(mysql).
I made the changes in httpd.conf.

It's not working properly. I can't run some of the php3 files. The browser want to save them as files on the Hard Drive. But some other php3 files run ok.

Maybe I chose some wrong configuration options.

Which configuration options should I use normally for installing PHP3 (DSO)?

I've got 3 that are obligatory:

./configure
--with-apxs=/usr/sbin/apxs
--enable-versioning
--with-mysql

What other options should I use?
floschi
Userprojekt
Userprojekt
Posts: 3247
Joined: 2002-07-18 08:13
Location: München
Contact:
 

Re: Using php3 and php4 as concurrent Apache Modules

Post by floschi »

gnome_x wrote:It's not working properly. I can't run some of the php3 files. The browser want to save them as files on the Hard Drive. But some other php3 files run ok.
Sure you've cleaned your browser cache? That could happen...
gnome_x
Posts: 13
Joined: 2002-07-15 04:50
Location: Bonn/Köln
 

Re: Using php3 and php4 as concurrent Apache Modules

Post by gnome_x »

It is not the browser. I have tried it on several browsers, and several computers.

Some browsers want to download the php3 files, some other just dispay the files source code on the browser window
jamesb
Posts: 661
Joined: 2002-05-08 15:35
Location: Karlsruhe
Contact:
 

Re: Using php3 and php4 as concurrent Apache Modules

Post by jamesb »

Do you have an "AddType"-rule for php3 in your apache configuration?

JamesB
gnome_x
Posts: 13
Joined: 2002-07-15 04:50
Location: Bonn/Köln
 

Re: Using php3 and php4 as concurrent Apache Modules

Post by gnome_x »

Here are the rows that configure php in httpd.conf:

Code: Select all


LoadModule php3_module        /usr/lib/apache/libphp3.so

AddModule mod_php3.c

    # PHP 3.x:
    #
    <IfModule mod_php3.c>
    AddType application/x-httpd-php3 .php3
    AddType application/x-httpd-php3-source .phps
    AddType application/x-httpd-php3 .phtml
    </IfModule>

    #
    # PHP 4.x:
    #
    <IfModule mod_php4.c>
    AddType application/x-httpd-php .php
    AddType application/x-httpd-php .php4
    AddType application/x-httpd-php-source .phps
    </IfModule>
I can't find any files called mod_php3.c or mod_php4.c (php 4 is working fine though) in my server.
gnome_x
Posts: 13
Joined: 2002-07-15 04:50
Location: Bonn/Köln
 

Still can't makeit run

Post by gnome_x »

I still haven't gotten the two versions of PHP runing concurrently.

I think the problem is on the way that I configure PHP3.

Could you please give me some instructions on which options should I use when configuring PHP3.

Thanx in forward
Post Reply