I've had two (or three) versions installed on my Fedora linux server. It seems I've had something installed when I just rented server, after that I've tried to upgrade by building PHP from source.
PHP, installed with yum (before upgrading) had 5.1.6 version. When I ran phpinfo(), browser displayed this version. But when I ran "php -v" in command line, it displayed 5.2.5 version.
I've got this error when server booted up:
[20-Nov-2007 03:27:30] PHP Warning: PHP Startup: json: Unable to initialize module Module compiled with module API=20060613, debug=0, thread-safety=0 PHP compiled with module API=20050922, debug=0, thread-safety=0 These options need to match in Unknown on line 0
So, I've removed old version(s):
rpm -qa ¦ grep php rpm -e *package*
yum remove php
Then I've downloaded latest version of PHP 5.2.5 and installed it. I've copied configuration list that yum uses for older version:
The package manager probably sets up the Apache configuration during the installation. If PHP is functioning at the command line once compiled, then you will probably need to edit httpd.conf yourself to load any PHP modules, set up mime types, etc.
Whe I try to load any .php page, I get PHP source code as simple text instead of result of executed PHP code.
This is because Apache doesn't know that your PHP files should be post-processed by your PHP interpreter. To solve this you have to load the PHP Apache module with a LoadModule in httpd.conf command and mark .php files as parseable with the line
AddType application/x-httpd-php .php
Look in your PHP documentation for details as the settings in the httpd.conf might vary slightly between different PHP and Apache versions.