homepage Welcome to WebmasterWorld Guest from 54.167.179.48
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Home / Forums Index / Hardware and OS Related Technologies / Linux, Unix, and *nix like Operating Systems
Forum Library, Charter, Moderators: bakedjake

Linux, Unix, and *nix like Operating Systems Forum

    
PHP doesn't work with Apache2
alexey9

10+ Year Member



 
Msg#: 3512381 posted 11:42 am on Nov 24, 2007 (gmt 0)

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:

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

./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?

 

encyclo

WebmasterWorld Senior Member encyclo us a WebmasterWorld Top Contributor of All Time 10+ Year Member



 
Msg#: 3512381 posted 4:40 pm on Nov 25, 2007 (gmt 0)

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.

lammert

WebmasterWorld Senior Member lammert us a WebmasterWorld Top Contributor of All Time 5+ Year Member



 
Msg#: 3512381 posted 12:58 pm on Nov 26, 2007 (gmt 0)

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.

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Hardware and OS Related Technologies / Linux, Unix, and *nix like Operating Systems
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved