![]() |
ubuntu.com - launchpad.net - ubuntu help
|
|
|||||||
Hello, Unregistered You are browsing a READ only archive of the main support categories pre 4/21/2008. You will not be able to post or reply any threads in this section.
|
|
Server Platforms Discussion regarding any server based ubuntu release. |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Just Give Me the Beans!
![]() Join Date: Sep 2006
Beans: 67
|
PHP: Function works in CLI but not through browser
Hi all,
Further from my Informix post a bit down the forum, I have struck a new problem. Informix support is actually 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 |
|
|
|
|
|
#2 | |
|
Skinny Extra Sweet Ubuntu
![]() |
Re: PHP: Function works in CLI but not through browser
Hi there,
The only other files that would affect how external libraries work via Apache are the libraries themselves, I'd say. Here are some things to check, although I'm afraid they're all long shots!
I have no idea if this is relevant, but I found the following at http://forums.gentoo.org/viewtopic.php?t=245249 ... Quote:
It seems (on Gentoo at least!) as though there are some special environment variables required for Informix to run properly. If this is true, you need to find them, and set them in Apache's startup script. Apache takes special measures to discard environment settings when it starts (mostly as a security precaution), which is why this may be necessary. Anything you want to keep has to be explicitly defined, without using the "export" or "set" commands. Code:
$ nl /etc/init.d/apache2 |grep ENV
5 ENV="env -i LANG=C PATH=/usr/local/bin:/usr/bin:/bin"
21 APACHE2="$ENV /usr/sbin/apache2"
22 APACHE2CTL="$ENV /usr/sbin/apache2ctl"
If this does indeed solve your problem, there's one more step to perform, since this change will create problems any time Ubuntu updates Apache for you. Let me know! I hope this helps. Last edited by kidders; February 9th, 2007 at 11:28 AM.. |
|
|
|
|
|
|
#3 |
|
Just Give Me the Beans!
![]() Join Date: Sep 2006
Beans: 67
|
Re: PHP: Function works in CLI but not through browser
Hi,
Many thanks for taking the time to write such a detailed reply. I'll give it a try later today and report back here Cheers, Matt |
|
|
|
|
|
#4 |
|
Skinny Extra Sweet Ubuntu
![]() |
Re: PHP: Function works in CLI but not through browser
No problem.
|
|
|
|
|
|
#5 |
|
Just Give Me the Beans!
![]() Join Date: Sep 2006
Beans: 67
|
Re: PHP: Function works in CLI but not through browser
Hi,
Well, i've tried it out, and unfortunately, i already had all the necessary variables declared in the /etc/init.d/apache2 script To make matters worse, the script has stopped working through the command line too - I now get the ifx_connect() is not defined message. Oddly, I don't remember changing anything since it was last working I'm going to go back over my files now to see what I might have changed. The only thing that might be different is the environment variables, although entering php -i | grep -i "informix" on the command line gives the following: Code:
PATH => /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/bin/X11:/usr/games:/opt/informix/bin INFORMIXSERVER => servername _SERVER["PATH"] => /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/bin/X11:/usr/games:/opt/informix/bin _SERVER["INFORMIXSERVER"] servername _ENV["PATH"] => /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/bin/X11:/usr/games:/opt/informix/bin _ENV["INFORMIXSERVER"] => servername I'm downloaded a Gentoo VMWare appliance to experiment with, but i'd much prefer to get it working on Ubuntu as i already have a server up and running. Any further ideas to try? Cheers, Matt |
|
|
|
|
|
#6 | |
|
Skinny Extra Sweet Ubuntu
![]() |
Re: PHP: Function works in CLI but not through browser
Eek!
![]() Quote:
Have you taken a look at the informix website? Whenever things don't work all by themselves (which is fairly often!), I tend to just configure them manually, based on the developer's instructions. |
|
|
|
|
|
|
#7 |
|
Just Give Me the Beans!
![]() Join Date: Sep 2006
Beans: 67
|
Re: PHP: Function works in CLI but not through browser
Hi Kidders,
Well, I got the CLI working again by recompiling PHP - still doesn't work through Apache unfortunately. The annoying thing with Informix is that the documentation is exceptionally poor. The only real guides I could find were either vague, or based on other Linux distro's (e.g. Gentoo), and I couldn't translate the instructions across well enough. Is it possible that the informix functions need to be compiled into some sort of module that can then be enabled to run alongside Apache with a2enmod? Cheers, Matt |
|
|
|
|
|
#8 |
|
Skinny Extra Sweet Ubuntu
![]() |
Re: PHP: Function works in CLI but not through browser
I have no idea
|
|
|
|
|
|
#9 |
|
Just Give Me the Beans!
![]() Join Date: Sep 2006
Beans: 67
|
Re: PHP: Function works in CLI but not through browser
Humm, I'm really stuck with this.
So far, i've tried to install Gentoo on a spare PC, but it kept erroring towards the end of the install. I've then put a new install of Ubuntu on a spare machine and tried to compile PHP5.2 and Apache 2 from source with Informix support. That ended up giving me plenty of errors too. So I land back where I started. It appears that I have sucessfully recompiled php-cli with Informix support, but mod_php has either not been recompiled, or the new version is not loaded by Apache. By reconfiguring PHP from source, should mod_php be recompiled? If so, will it be stored somewhere waiting for me to activate it (and hence Apache is using the old version without informix support)?? <grasping at straws> Matt |
|
|
|
|
|
#10 |
|
Just Give Me the Beans!
![]() Join Date: Sep 2006
Beans: 67
|
Re: PHP: Function works in CLI but not through browser
Kidders - i've done it!
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 Code:
./configure --with-apxs2=/usr/bin/apxs2 --with-informix=/opt/informix Code:
make Code:
make install After then loading the PHP5 module into Apache via: Code:
a2enmod php5 Code:
Open cursor fails (E [SQLSTATE=IX 000 SQLCODE=-200]) So, thank you again for your help - it is most appreciated. I can now crack on with my project Cheers, Matt |
|
|
|
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|