Ubuntu PHP: Function works in CLI but not through browser

Associate
Joined
19 Jun 2003
Posts
1,680
Location
West Yorks, UK
Hi all,
I'm trying to link up a Ubuntu 6.06 LTS server to an Informix database (running on another machine).

The Informix client SDK is installed and configured fine, but I can only use the ifx_*() functions through CLI. If i try to use them through the browser, I get the "Fatal error: Call to undefined function ifx_connect()" error.

I have copied the php.ini from /etc/php5/cli to /etc/php5/apache2 and forced a reload on Apache2 using "/etc/init.d/apache2 force-reload". However, I still cannot access the ifx_*() functions.

What other files/folders could be affecting this? I assumed that it would just be php.ini, but does apache2.conf have a hand in it too? If not, what else should I be looking at?

Cheers,
Matt
 
have you checked the packages? there are packages phpX-cli-module and just phpX-module , you might have just the cli version installed. or maybe you need to add it in apache2.conf. wouldn't have thought so though.
 
Yeah, checked over my package list. I think i have figured out what has happened, but don't know how to fix it :S

Basically, I have downloaded the PHP source and recompiled it with Informix support. However, this hasn't recompiled libapache2-mod-php5, which is otherwise known as mod_php I believe.

In Ubuntu in the Synaptic Package Manager, it lists the configure options for libapache2-mod-php5, and they don't include Informix of course ;)

So, how can I recompile libapache2-mod-php5 on its own?

Matt
 
Sorted!

The trick was as above, mod_php needed recompiling seperately from the normal php version. So, to do this, I downloaded the source for using:
Code:
apt-get source libapache2-mod-php5

I then used:
Code:
./configure --with-apxs2=/usr/bin/apxs2 --with-informix=/opt/informix
followed by
Code:
make
and
Code:
make install
.

After then loading the PHP5 module into Apache via:
Code:
a2enmod php5

I restarted Apache, and it works! However, the Informix SQL syntax seems to be tricky. I'm getting funny errors like
Code:
Open cursor fails (E [SQLSTATE=IX 000 SQLCODE=-200])

...But at least I've got the functions working now!

So, thank you again for your help - it is most appreciated. I can now crack on with my project :-)

Cheers,
Matt
 
Back
Top Bottom