Hello Alex,
I don't how much you already know know about compile PHP. Then i try to explain as more as possible what i have done.
I compiled PHP 4.0.3pl1 with both JDK1.2.2 and IBM JDK 1.3 under Suse 7.0. I use Apache 1.3.12 as WebServer.
Both compiled PHP worked well and I get it the same way. The following is how I do it:
A- Compile your PHP:
A-1- untar xvf php-4.0.3pl1 in the directory you want. I choose (/home/obaillard/devl/devltools/php-4.0.3pl1/), but it's up to you to choose what you want.
A-2- compile PHP:
In your new PHP directory (/home/obaillard/devl/devltools/php-4.0.3pl1/), do:
./configure --prefix=/home/obaillard/tmp/ --with-apxs --with-mysql --with-java=/home/obaillard/dev/devltools/jdk1.2.2/ --enable-ftp --enable-debug
for example if you want to use JDK 1.2.2. The --with-java option point only to a local version in my home directory. But it doesn't matter where you JDK is.
A-3- make PHP:
do: make install
At this point, I become the error, that I can't copy a file in the /usr/local/local. I suppose it's because I compile PHP as normal user and not as root. I don't understand it really because i choose the option "--prefix" so that it point in my home directory. Anyway, it doesn't seem to disturb PHP.
A-4- All right. PHP ready!
B- Update Apache httpd.conf
B-1- Personally, i toke the libphp4.so from the /home/obaillard/devl/devltools/php-4.0.3pl1/libs/ directory and made a copy in the (/home/obaillard/devl/devltools/modules/ directory. It's the location where I put all my modules for apache.
B-2- Change httpd.conf
The config file have to contains the following commans:
<IfDefine PHP4>
LoadModule php4_module /home/obaillard/devl/modules/libphp4.so
</IfDefine>
......
<IfDefine PHP4>
AddModule mod_php4.c
</IfDefine>
......
<IfDefine PHP4>
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
</IfDefine>
B-3 Reload or restart your Apache
I use a local httpd.conf. Then I use the following command:
/usr/sbin/httpd -f /home/obaillard/...(path to my httpd.conf file)/httpd.conf -DPHP4
If you don't use a local version of httpd.conf but the main version of apache, then you have to look in the /sbin/init.d/apache script if you find the command
test -e /(path to your libphp4.so)/libphp4.so && MODULES="-D PHP4 $MODULES"
If not, write it.
Then restart your apache:
rcapache restart
Hopfully will it works!!!!
About -- What do you mean by "it works (almost)"? --. I say almost because I want to use PHP as servlet with apache and tomcat. Apache is responsible of normal HTML page and .php extension are redirect to Tomcat who 'll use PHP servlet to handle the request. This means I compiles PHP with the --with-servlet option and the --with-java option. With this options, I can't connect normally to a MySQL database with "mysql_connect" -- When I try. I only wait and wait and nothing happens --. But I can connect to the MySQL with a java class of mine who is using JDBC. Oracle and others stuff work fine too.
The other problem I have with java extension is that I can only exchange simple type variables between PHP and JAVA world. Also I mean int, boolena, string and table of this simple type. I have found no way to exchange some more complex data structure.
And finally only with IBM JDK1.3: When my TOMCAT run using this version of java, then it simply "freeze" after some time (15 minutes until some hours ?!?!?) and nothing more work. With JDK1.2.2, it doesn't happens.
So I hope it will help you. If you have more interessing experiences with PHP/JAVA I would be naturally happy to hear of it. I think it's really not to bad.
Bye,
Olivier