Re: PHP doesn't work with Apache2

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]



On Sat, 24 Nov 2007, BuildSmart wrote:

To: ApplePro <applepro7777@xxxxxxxxx>
From: BuildSmart <buildsmart@xxxxxxxxxxxxxxxxxx>
Subject: Re:   PHP doesn't work with Apache2


On Nov 24, 2007, at 07:01:56, ApplePro wrote:

Hello guys,

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:

Quote:
[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):

Quote:
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:

Quote:
./configure --build=x86_64-unknown-linux-gnu --host=x86_64-unknown-linux-gnu
--target=x86_64-redhat-linux-gnu --program-prefix= --prefix=/usr
--exec-prefix=/usr --bindir=/usr/bin --sbindir=/usr/sbin --sysconfdir=/etc
--datadir=/usr/share --includedir=/usr/include --libdir=/usr/lib64
--libexecdir=/usr/libexec --localstatedir=/var --sharedstatedir=/usr/com --mandir=/usr/share/man --infodir=/usr/share/info --cache-file=../config.cache
--with-libdir=lib64 --with-config-file-path=/etc
--with-config-file-scan-dir=/etc/php.d --disable-debug --with-pic
--disable-rpath --without-pear --with-bz2 --with-curl --with-exec-dir=/usr/bin
--with-freetype-dir=/usr --with-png-dir=/usr --enable-gd-native-ttf
--without-gdbm --with-gettext --with-gmp --with-iconv --with-jpeg-dir=/usr
--with-openssl --with-png --with-pspell --with-expat-dir=/usr
--with-pcre-regex=/usr --with-zlib --with-layout=GNU --enable-exif --enable-ftp --enable-magic-quotes --enable-sockets --enable-sysvsem --enable-sysvshm
--enable-sysvmsg --enable-track-vars --enable-trans-sid --enable-yp
--enable-wddx --with-kerberos --enable-ucd-snmp-hack --with-unixODBC=shared,/usr --enable-memory-limit --enable-shmop --enable-calendar --enable-dbx --enable-dio
--with-mime-magic=/usr/share/file/magic.mime --without-sqlite
--with-libxml-dir=/usr --with-xml --with-apxs2=/usr/sbin/apxs --without-mysql --without-gd --without-odbc --disable-dom --disable-dba --without-unixODBC --disable-pdo --disable-xmlreader --disable-xmlreader --disable-xmlwriter


make clean
make
make install
After that PHP doesn't work with Apache2. Whe I try to load
any .php page, I get PHP source code as simple text instead
of result of executed PHP code.

When I install PHP with yum again, it works.

I wonder how can I install latest PHP from source? How to fix
the problem with Apache2?

To add to Dave's points:

Maybe the yum install of php is adding the following line to your httpd.conf file for you, which you will need to add manually when you compile php yourself?

AddType application/x-httpd-php .php

AddType application/x-httpd-php .hml
AddType application/x-httpd-php .htm
AddType application/x-httpd-php .html

Without this in your in httpd.conf file, php code will not be handed over to the php interpreter for parsing, so you will get php code returned to your browser window, instead of it executing on the server machine.

Regards

Keith Roberts

By your pseudo-name you give the impression that you know something about Mac OS X which also implies you know a little more than the basics but ask a question that is extremely basic and expected from someone who is wet behind the ears.

You have two issues, the php apache module you're loading is from the older 5.1.6 branch and your php.ini is trying to load php modules from the 5.2.5 build.

OLD PHP EXTENSION DIRECTORY:
/usr/lib/php/extensions/no-debug-non-zts-20050922

NEW PHP EXTENSION DIRECTORY
/usr/lib/php/extensions/no-debug-non-zts-20060613

This leave you with 2 options, load the newer apache php module or change your php.ini to point to the OLD PHP EXTENSION DIRECTORY.

You should be able to locate the new module you built by looking in the php source directory that you built in, then look in your apache module directory for a file of the same name and date.

One issue that occurs a lot in linux is that the module defined in the httpd.conf file isn't stored in the apache module directory so look and see where it's loading this module from and either copy the new one or point the path to the new module.

-- Dale

[Index of Archives]     [PHP Users]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [Postgresql]     [PHP Books]     [PHP Databases]     [PHP SOAP]
  Powered by Linux