Apache + mod_php4 does not run php codes - BSD
This is a discussion on Apache + mod_php4 does not run php codes - BSD ; I've installed php4 (and tried also php5 ) on chrooted (and also with
httpd -u flag)
Apache/1.3.29 with system packages.
I have confused that, apache dumps teh sources of both php and some
invalid html sources , whatever configuration i ...
-
Apache + mod_php4 does not run php codes
I've installed php4 (and tried also php5 ) on chrooted (and also with
httpd -u flag)
Apache/1.3.29 with system packages.
I have confused that, apache dumps teh sources of both php and some
invalid html sources , whatever configuration i have done.
LoadModule php4_module /usr/lib/apache/modules/libphp4.so
DirectoryIndex index.html index.htm index.php
Server Name : also ok
AddType application/x-httpd-php-source .phps
AddType application/x-httpd-php .php
I see that mod_php4 is active on /server-info and also error_log
php is exposing herself to error_log file and ServerToken.
but apache response to htp://localhost/test.php to
echo "test";
?>
and also i have written a dummy.html
apache responded as
dummy
TypesConfig conf/mime.types
DefaultType text/html
are both included in httpd.conf
in /var/www/conf/php.ini
engine = On
session.save_path = /tmp
default_mimetype = "text/html"
expose_php = On
/var/www/tmp is chowoned by www:www and writable
drwx------ 2 www www 512 Mar 28 15:53 tmp
there is not problem with php-modules etc..
they were all working in command line
and I have removed all and only install php4-core package
and run phpize -s
I have diabled chroot env. of apache with httpd -u
but it did not change anything, i gurs notrlated to chroot environment
is mod_php4 looking for php.ini at else for /var/www/conf/php.ini ? or
php can not get any environment variable ? I check the http headers and
there is no PHP header
# telnet localhost 80
Trying ::1...
telnet: connect to address ::1: Connection refused
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
GET /test.php HTTP/1.0
HTTP/1.1 200 OK
Date: Tue, 11 Apr 2006 10:34:37 GMT
Server: Apache/1.3.29 (Unix)
Last-Modified: Tue, 11 Apr 2006 10:31:11 GMT
ETag: "0319156fe946bea353aa6edab3399d1e9aac7883"
Accept-Ranges: bytes
Content-Length: 23
Connection: close
Content-Type: text/plain
echo "TEST";
?>
Connection closed by foreign host.
#
-
Re: Apache + mod_php4 does not run php codes
ilker ARABACI wrote:
> I've installed php4 (and tried also php5 ) on chrooted (and also with
> httpd -u flag)
> Apache/1.3.29 with system packages.
>
>
> I have confused that, apache dumps teh sources of both php and some
> invalid html sources , whatever configuration i have done.
>
> LoadModule php4_module /usr/lib/apache/modules/libphp4.so
> DirectoryIndex index.html index.htm index.php
> Server Name : also ok
>
> AddType application/x-httpd-php-source .phps
> AddType application/x-httpd-php .php
>
>
> I see that mod_php4 is active on /server-info and also error_log
> php is exposing herself to error_log file and ServerToken.
>
> but apache response to htp://localhost/test.php to
>
> echo "test";
> ?>
>
> and also i have written a dummy.html
> apache responded as
>
> dummy
>
> TypesConfig conf/mime.types
> DefaultType text/html
>
> are both included in httpd.conf
>
> in /var/www/conf/php.ini
> engine = On
> session.save_path = /tmp
> default_mimetype = "text/html"
> expose_php = On
>
> /var/www/tmp is chowoned by www:www and writable
> drwx------ 2 www www 512 Mar 28 15:53 tmp
>
> there is not problem with php-modules etc..
> they were all working in command line
> and I have removed all and only install php4-core package
> and run phpize -s
> I have diabled chroot env. of apache with httpd -u
> but it did not change anything, i gurs notrlated to chroot environment
>
>
> is mod_php4 looking for php.ini at else for /var/www/conf/php.ini ? or
> php can not get any environment variable ? I check the http headers and
> there is no PHP header
>
>
> # telnet localhost 80
> Trying ::1...
> telnet: connect to address ::1: Connection refused
> Trying 127.0.0.1...
> Connected to localhost.
> Escape character is '^]'.
> GET /test.php HTTP/1.0
>
> HTTP/1.1 200 OK
> Date: Tue, 11 Apr 2006 10:34:37 GMT
> Server: Apache/1.3.29 (Unix)
> Last-Modified: Tue, 11 Apr 2006 10:31:11 GMT
> ETag: "0319156fe946bea353aa6edab3399d1e9aac7883"
> Accept-Ranges: bytes
> Content-Length: 23
> Connection: close
> Content-Type: text/plain
>
>
> echo "TEST";
> ?>
>
> Connection closed by foreign host.
> #
The above should work. Please stop apache, start apache, and request the
PHP page. Then post the error log.
Also post a diff -u between the default httpd.conf/php.ini and your
versions.
Have you used phpxs as the port suggests? What version of OpenBSD are
you using? I assume you are using stock apache, and using packages that
are meant for this version?
Joachim
-
Re: Apache + mod_php4 does not run php codes
diff files will be full of lines
but i have noticed
www:*:67:67:HTTP Server:/var/www:/sbin/nologin
# grep ww /etc/passwd
www:*:67:67:HTTP Server:/var/www:/sbin/nologin
# grep nobody /etc/passwd
nobody:*:32767:32767:Unprivileged user:/nonexistent:/sbin/nologin
two unprividge user exists.
if i remove nobody ( www is default on httpd.conf) apache does first
erronous startup.
there was no error before.
grep nobody /usr/sbin/httpd matches.
i have added
useradd -s /sbin/nologin -d /var/www -g nobody nobody
nothing has changed
-
Re: Apache + mod_php4 does not run php codes
ilker ARABACI wrote:
> diff files will be full of lines
> but i have noticed
>
> www:*:67:67:HTTP Server:/var/www:/sbin/nologin
> # grep ww /etc/passwd
>
>
> www:*:67:67:HTTP Server:/var/www:/sbin/nologin
>
> # grep nobody /etc/passwd
>
>
[N.B.: Please quote previous messages, adding your comments withing
context. It can be hard to try to figure out who you are talking to or
what you are responding to.]
It should be "www", and the stock httpd.conf User and Group settings
will reflect that. Leave this alone. Do not use "nobody".
Consider supplying the information requested earlier: a diff of the
http.conf and the error message you are getting.
-
Re: Apache + mod_php4 does not run php codes
ilker ARABACI wrote:
> diff files will be full of lines
> but i have noticed
>
> www:*:67:67:HTTP Server:/var/www:/sbin/nologin
> # grep ww /etc/passwd
>
>
> www:*:67:67:HTTP Server:/var/www:/sbin/nologin
>
> # grep nobody /etc/passwd
>
>
> nobody:*:32767:32767:Unprivileged user:/nonexistent:/sbin/nologin
>
> two unprividge user exists.
> if i remove nobody ( www is default on httpd.conf) apache does first
> erronous startup.
>
> there was no error before.
>
> grep nobody /usr/sbin/httpd matches.
>
> i have added
> useradd -s /sbin/nologin -d /var/www -g nobody nobody
>
> nothing has changed
Messing around with the 'nobody' account will likely lead to trouble.
For instance, are /etc/master.passwd and /etc/passwd still synchronized?
With each other? With their respective .db files? Did 'nobody' change
login class?
Use vipw if you want to bypass as much control as can safely be
bypassed, and see pwd_mkdb(8) for the rest.
I'd still be happy to see the diff, though. FWIW, the relevant parts of
*my* diff appear to be:
LoadModule php5_module /usr/lib/apache/modules/libphp5.so
AddType application/x-httpd-php .php
Which really should be all that's required. Without configuration or log
files, that's all that can be said.
Joachim
-
Re: Apache + mod_php4 does not run php codes
I have solved the problem with recomplig httpd from source tree.
After diognosing ,
Problem had been with httpd.conf file
AddModule module.c , and ClearModules directives has been cleaned by
one of my previous application installitions.