Click to See Complete Forum and Search --> : php-httpd on RH. no laughing matter


klas
10-21-2003, 12:47 AM
:confused:

I cannot believe this - is ANYONE able to run php and apache on Linux? To give the short story:

I run, for the moment, I've tried three other PHPs as well, Apache 1.3.28:

-Red Hat Linux 8.0 3.2-7
-PHP 4.3.3
-Apache/2.0.46
-postgresql-7.2.3

postgres is not an issue, works fine, php on it's own too, for instance I tested on a web page called news.html containing
..
<?php
if($con = pg_connect('host=localhost port=5432 user=me dbname=mine')){
echo 'got conn';
}else{
echo 'no conn';
}
?>
..
like php -f news.html and it works fine (ie I get "got conn". But getting Apache to work with php.. it just nonsense, huh?

Configured apache like:

./configure --enable-module=most --enable-shared=max --with-perl=/usr/bin/perl

configured php like like:

./configure --with-apxs2=/usr/local/apache2/bin/apxs --with-pgsql=/usr/local/pgsql

added these things to my http.conf:

# php stuff

ScriptAlias /php4/ "/usr/local/bin/"
AddType application/x-httpd-php4 .php .php4 .phtml .html
AddHandler cgi-script cgi php html

Using httpd 2.0.46, I always get this (familiar yet never properly solved?) thing:

Starting httpd: httpd: module "/usr/src/build/144344-i386/BUILD/php-4.2.2/sapi/apache2filter/sapi_apache2.c" is not compatible with this version of Apache (found 20020628, need 20020903).
Please contact the vendor for the correct version.

alternatively, when trying out some elder PHP together with some elder httpd always:

Starting httpd: Syntax error on line 951 of /usr/local/apache/conf/httpd.conf:
Cannot load /usr/lib/httpd/modules/libphp4.so into server: /usr/lib/httpd/modules/libphp4.so: undefined symbol: apr_bucket_type_file

It just.. it NEVER works to load this module?

Eventually I thought, fine, skip it, let's just make sure httpd has the path to my ordinary php binary, that making it possible to parse php stuff at all, I thought? Well..

ScriptAlias /php4/ "/usr/local/bin/"
Action application/x-httpd-php4 "/php4/php"

in httpd.conf just doesn't do any good either of course.

You get tired, fed up, sick with. If I can't get advices that work, pity would do for now.

klas
10-21-2003, 10:05 AM
Ok - It was me, partly at least.. :)

Everyone seems to say httpd1.3.27 should work with php4. New try:

(always make _sure_ you clean up any old one.. I didn't before)

cd apache_1.3.27_src/
./configure --enable-module=most --enable-shared=max --with-perl=/usr/bin/perl
make && make install
emacs /usr/local/apache/conf/httpd.conf & -fixed it.

cd /root/postgres/sc/php4-STABLE-200310202130
make clean

./configure --with-apxs=/usr/local/apache/bin/apxs --with-pgsql=/usr/local/pgsql
make
make install

Then changed my /etc/init.d/httpd boot script to run this
apache instead, and APACHEHOME in my .tcshrc, sourced it,
rehashed.

OK.. it... WORKS!!!!!!!!!

root : [ 14:28 ] # httpd -v
Server version: Apache/1.3.27 (Unix)
Server built: Oct 21 2003 14:10:29

root : [ 14:29 ] # php -v
PHP 4.3.4RC3-dev (cli) (built: Oct 21 2003 13:51:36)
Copyright (c) 1997-2003 The PHP Group
Zend Engine v1.3.0, Copyright (c) 1998-2003 Zend Technologies

The problem was, apart from any suspected incompability, seemed to be I was
still trying to load an old php module! The php stuff
I use in my httpd.conf is:

# MY SECTION for php

LoadModule php4_module "/usr/local/apache/libexec/libphp4.so"
AddType application/x-httpd-php .php3 .php4 .php
AddType application/x-httpd-php-source .phps HTH
ScriptAlias /php4/ "/usr/local/bin/php"
Action application/x-httpd-php4 "/usr/local/bin/php"

Only detail now is that I'd
like the file extensions to be .html still
and not .php4 which I have to use now.

I fixed this by adding the line

AddType application/x-httpd-php .html

to my php section in httpd.conf.

I'm a happy PHPer :) So - lesson - be absolutely certain your LoadModule in httpd.conf actually points to the module you got when building php4!! The make procedure gives you this path at the end of make install.

Of course I should have seen it.. well.