Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 49420 - After installing mod_php and updating /etc/conf.d/apache2, .php files are not parsed by PHP
Summary: After installing mod_php and updating /etc/conf.d/apache2, .php files are not...
Status: RESOLVED INVALID
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Server (show other bugs)
Hardware: x86 Linux
: High major
Assignee: PHP Bugs
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-04-29 13:49 UTC by Bryan Helmkamp
Modified: 2005-02-14 00:01 UTC (History)
3 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
My apache2.conf (apache2.conf,7.47 KB, text/plain)
2004-05-03 23:31 UTC, Bryan Helmkamp
Details
My commonapache2.conf (commonapache2.conf,31.35 KB, text/plain)
2004-05-03 23:32 UTC, Bryan Helmkamp
Details
Output of http://localhost/server-info (server-info.html,67.98 KB, text/html)
2004-05-03 23:33 UTC, Bryan Helmkamp
Details
Output of http://localhost/server-status (server-status.html,1.73 KB, text/html)
2004-05-03 23:33 UTC, Bryan Helmkamp
Details
Output of /usr/sbin/apache2 -k start -D PHP4 -X -e Debug (debug_output.txt,3.66 KB, text/plain)
2004-05-04 10:44 UTC, Bryan Helmkamp
Details
My /etc/apache2/conf/ directory (apache2-conf.tar,100.00 KB, application/x-tar)
2004-06-05 03:29 UTC, Bryan Helmkamp
Details
Latest server-info (server-info.html,67.97 KB, text/html)
2004-06-05 03:31 UTC, Bryan Helmkamp
Details
Latest server-status (server-status.html,1.69 KB, text/html)
2004-06-05 03:31 UTC, Bryan Helmkamp
Details
Latest debugging output (logfile,163.45 KB, text/plain)
2004-06-05 17:43 UTC, Bryan Helmkamp
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Bryan Helmkamp 2004-04-29 13:49:22 UTC
I emerge apache and mod_php and edited /etc/conf.d/apache2 to have the line at the top:

APACHE2_OPTS="-D PHP4"

The server starts up fine (without warnings or errors) and serves pages, but it will not parse PHP any code.

Reproducible: Always
Steps to Reproduce:
1. emerge mod_php and apache
2. Edit /etc/conf.d/apache2 to have the line APACHE2_OPTS="-D PHP4"
3. Restart apache
4. Request a .php file that has PHP code in it

Actual Results:  
Raw PHP source code was sent to my web browser.

Expected Results:  
Parsed the PHP source and displayed the result.

Posted about this in this thread in the forums:

http://forums.gentoo.org/viewtopic.php?t=166552

Other people reported having the same problem.

Performing Global Updates: /usr/portage/profiles/updates/2Q-2004
(Could take a couple minutes if you have a lot of binary packages.)
  .='update pass'  *='binary update'  @='/var/db move'
  s='/var/db SLOT move' S='binary SLOT move'
.........................
Portage 2.0.50-r6 (default-x86-1.4, gcc-3.3.2, glibc-2.3.2-r9, 2.6.5-gentoo)
=================================================================
System uname: 2.6.5-gentoo i686 AMD Athlon(tm) XP 2700+
Gentoo Base System version 1.4.3.13
ccache version 2.3 [enabled]
Autoconf: sys-devel/autoconf-2.58-r1
Automake: sys-devel/automake-1.8.3
ACCEPT_KEYWORDS="x86"
AUTOCLEAN="yes"
CFLAGS="-march=athlon-xp -O3 -pipe -fomit-frame-pointer"
CHOST="i686-pc-linux-gnu"
COMPILER="gcc3"
CONFIG_PROTECT="/etc /usr/X11R6/lib/X11/xkb /usr/kde/2/share/config
/usr/kde/3.1/share/config /usr/kde/3.2/share/config /usr/kde/3/share/config
/usr/lib/mozilla/defaults/pref /usr/share/config /var/qmail/control"
CONFIG_PROTECT_MASK="/etc/gconf /etc/terminfo /etc/env.d"
CXXFLAGS="-march=athlon-xp -O3 -pipe -fomit-frame-pointer"
DISTDIR="/usr/portage/distfiles"
FEATURES="autoaddcvs ccache sandbox"
GENTOO_MIRRORS="ftp://ftp.gtlib.cc.gatech.edu/pub/gentoo
rsync://gentoo.seren.com/gentoo http://gentoo.noved.org/ ftp://gentoo.noved.org/"
MAKEOPTS="-j2"
PKGDIR="/usr/portage/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY="/usr/local/portage"
SYNC="rsync://rsync.us.gentoo.org/gentoo-portage"
USE="X aalib alsa apm arts avi berkdb bonobo cdr crypt cups dvd encode esd
foomaticdb gdbm gif gnome gpm gtk gtk2 gtkhtml imlib innodb java jpeg libg++
libwww mad mikmod motif mozilla mpeg mysql nas ncurses nls oggvorbis opengl oss
pam pdflib perl png postgres ppds python qt quicktime readline scanner sdl slang
slp spell ssl svga tcltk tcpd tiff truetype usb x86 xml2 xmms xv zlib"
Comment 1 Andrew Roberts 2004-04-30 18:46:20 UTC
works fine for me.
Comment 2 Olmo Ziarko 2004-05-03 15:14:33 UTC
I had the same problem; i think APACHE2_OPTS simply gets ignored because
'sudo apache2 -k start -D PHP4' fires up an apache daemon that does parse
php scripts.
Comment 3 Robin Johnson archtester Gentoo Infrastructure gentoo-dev Security 2004-05-03 20:44:41 UTC
please include the output from 'ps -ef |grep apache2'
you say you edited /etc/conf.d/apache2  and added the APACHE2_OPTS="-D PHP4"
line to the top, did you comment out the other line with APACHE2_OPTS or leave it in ?

how did you restart apache?
/etc/init.d/apache2 restart ?
Comment 4 Bryan Helmkamp 2004-05-03 22:53:09 UTC
I replaced the existing APACHE2_OPTS line (that has -D SSL on it) with APACHE2_OPTS="-D PHP4".  I've also tried leaving "-D SSL" in the options, but that doesn't fix the problem.  Yes, I am using /etc/init.d/apache2 to start, stop, and restart Apache.

Ouput from ps -ef |grep apache2:

root     26045     1  0 01:52 ?        00:00:00 /usr/sbin/apache2 -k start -D PHP4
root     26052 24753  0 01:52 pts/11   00:00:00 grep apache2
Comment 5 Robin Johnson archtester Gentoo Infrastructure gentoo-dev Security 2004-05-03 23:25:59 UTC
please enable /server-info and /server-status in the apache2 config, and attach the output from http://host/{server-info,server-status} here.

please also attach your apache2.conf and commonapache2.conf here.
Comment 6 Bryan Helmkamp 2004-05-03 23:31:46 UTC
Created attachment 30667 [details]
My apache2.conf
Comment 7 Bryan Helmkamp 2004-05-03 23:32:11 UTC
Created attachment 30668 [details]
My commonapache2.conf
Comment 8 Bryan Helmkamp 2004-05-03 23:33:07 UTC
Created attachment 30669 [details]
Output of http://localhost/server-info
Comment 9 Bryan Helmkamp 2004-05-03 23:33:38 UTC
Created attachment 30670 [details]
Output of http://localhost/server-status
Comment 10 Robin Johnson archtester Gentoo Infrastructure gentoo-dev Security 2004-05-04 10:08:08 UTC
hmm, strange.
please run:
'/etc/init.d/apache2 stop'

'/usr/sbin/apache2 -t -D PHP4 ; echo $?' - see if there is any output from this (if the output isn't just a '0', then please include it here).

'/usr/sbin/apache2 -k start -D PHP4' - again, i'm interested in any output

if neigther of the above two give any output
try
'/usr/sbin/apache2 -k start -D PHP4 -X -e Debug' - and attach the full output after checking it for private information.
Comment 11 Bryan Helmkamp 2004-05-04 10:44:07 UTC
Result of executing the first two commands:

# /usr/sbin/apache2 -t -D PHP4 ; echo $?
Syntax OK
0

# /usr/sbin/apache2 -k start -D PHP4 prints no output
Comment 12 Bryan Helmkamp 2004-05-04 10:44:51 UTC
Created attachment 30720 [details]
Output of /usr/sbin/apache2 -k start -D PHP4 -X -e Debug
Comment 13 Bryan Helmkamp 2004-05-27 23:13:02 UTC
Any progress on this?  I still cannot get this to work.
Comment 14 Mario Vazquez 2004-05-28 09:43:47 UTC
The problem is not apache, is php installation.  Already was submited as bug #50991
http://bugs.gentoo.org/show_bug.cgi?id=50991

To fix the problem edit the /etc/php/apache2-php4/php.ini file 
and change this:
;include_path = ".:/php/includes"
into this:
include_path = "/usr/lib/php"

Also the /etc/php/cli-php4/php.ini
 have the same include_path entry as the file above, so probably it should be modified also..
Comment 15 Robin Johnson archtester Gentoo Infrastructure gentoo-dev Security 2004-05-28 14:40:58 UTC
i've fixed the include_path issue now.
Bryan: 
emerge sync ; emerge -u mod_php php ; 

and see if the issue is fixed for you.
Comment 16 Bryan Helmkamp 2004-06-04 21:47:54 UTC
Robin and Mario:

Sorry, no go.  My include_path line in all of my php.ini files now reads:

include_path = ".:/usr/lib/php"

But Apache is still not parsing any .php files.

The include_path issue seems unrelated because Apache is not sending my .php files to PHP to be parsed.

Any other ideas?
Comment 17 Robin Johnson archtester Gentoo Infrastructure gentoo-dev Security 2004-06-05 02:07:35 UTC
brian: could you tar up your entire /etc/apache2/conf directory and attach it here, along with new versions of your server-info and server-status.

also, could you start up a single threaded debug instance of httpd with php enabled, and see what happens when you hit a php page? (attach the log, it will probably be quite large).
Comment 18 Bryan Helmkamp 2004-06-05 03:29:55 UTC
Created attachment 32690 [details]
My /etc/apache2/conf/ directory
Comment 19 Bryan Helmkamp 2004-06-05 03:31:32 UTC
Created attachment 32691 [details]
Latest server-info
Comment 20 Bryan Helmkamp 2004-06-05 03:31:57 UTC
Created attachment 32692 [details]
Latest server-status
Comment 21 Bryan Helmkamp 2004-06-05 03:35:05 UTC
Robin,

What command do I need to run to get the debug output you want?
Comment 22 Robin Johnson archtester Gentoo Infrastructure gentoo-dev Security 2004-06-05 16:35:39 UTC
'strace -ff /usr/sbin/apache2 -k start -D PHP4 -X -e Debug 2>&1 | tee logfile'
then a call up a single php page with your browser.
it should generate a LOT of stuff into logfile.

Comment 23 Bryan Helmkamp 2004-06-05 17:43:03 UTC
Created attachment 32758 [details]
Latest debugging output

Result of "strace -ff /usr/sbin/apache2 -k start -D PHP4 -X -e Debug 2>&1 | tee
logfile"
Comment 24 Dave Liefbroer 2004-07-26 15:10:04 UTC
Your trace command says your php file looks like this:
<php
phpinfo();
?>

While it should read:
<?php
phpinfo();
?>

Note the ? in <?php
Comment 25 Robin Johnson archtester Gentoo Infrastructure gentoo-dev Security 2005-02-14 00:01:48 UTC
well done to Dave Liefbroer for spotting why your code was borked.
if this is still an issue once that is fixed, please reopen.