[Solved] PHP Versions

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Ferrino
Forum Newbie
Posts: 4
Joined: Wed Nov 12, 2003 11:39 am
Location: UK

[Solved] PHP Versions

Post 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
User avatar
gite_ashish
Forum Contributor
Posts: 118
Joined: Sat Aug 31, 2002 11:38 am
Location: India

Post 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.
User avatar
Johnm
Forum Contributor
Posts: 344
Joined: Mon May 13, 2002 12:05 pm
Location: Michigan, USA
Contact:

Post 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
Ferrino
Forum Newbie
Posts: 4
Joined: Wed Nov 12, 2003 11:39 am
Location: UK

Post 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.
User avatar
Johnm
Forum Contributor
Posts: 344
Joined: Mon May 13, 2002 12:05 pm
Location: Michigan, USA
Contact:

Post by Johnm »

Great, I am glad that I could help.
John M
Post Reply