Page 1 of 1

[Solved] PHP Versions

Posted: Wed Nov 12, 2003 11:39 am
by Ferrino
I am trying to get some test PHP pages to connect to a database and return the results in a webpage. We have an Apache webserver running a PHP module and a PostgreSQL database running on the same server.

If I run the PHP page (which tests the connection) on the webserver shell command line with %php dbcheck.php it returns the HTML which contains a couple of rows from the DB - fine.

But when I try to run the page in a web-browser I get nothing. It processes the include_once statement, but as soon as it tries to access the DB it fails.

Curiously, if I check the version of php on the webserver by running %php -v, it says 4.2.2, but when I run the PHP test page in a browser, it says 4.1.2. So is it possible that Apache is running a different version of PHP and that this is causing the problems?

I can't really see why it is working on the webserver command line but not in the browser.....

Many thanks for your help :D

Posted: Wed Nov 12, 2003 12:30 pm
by gite_ashish
from browser try -

<?php
phpinfo();
?>

and check - PostgreSQL support is available or not ?

Also in u r current script, enable debugging like (add at top of script) -

error_reporting(E_ALL);


This should show errors on browser itself, also if u have access to Apache/PHP log files check those files. The typical location on Linux - /var/log/httpd/* , or check the location in phpinfo()'s output.

hope this helps.

Posted: Wed Nov 12, 2003 12:35 pm
by Johnm
Ferrino,
I would bet that the web server has one version installed and the command line has a different version installed. Meaning... php was installed as a scripting language on the machine ( so you can use it like a shell script at the command line) and it was installed separately and with a different version for the web server. If that is the case, the it is possible that when it was installed for the web server, it may not have been installed with the db support for your db. Obviously the command line install was built with support for your db as you return data from the db. Make a file called phpinfo.php and put the phpinfo() command in it and view the page to see if support is installed for your db.
Hope this helps,

John M
John Mozurkewich

Database Manager

Midland Public Schools

Posted: Wed Nov 12, 2003 12:52 pm
by Ferrino
Thanks for the tips. I have now run phpinfo() on both the Apache and standalone versions and they do conflict. The Apache module returned --without-pgsql and the standalone --with-pgsql=shared.

I guess I need to speak to the webserver administrator to get the PHP module modified (and updated).

Cheers.

Posted: Wed Nov 12, 2003 12:53 pm
by Johnm
Great, I am glad that I could help.
John M