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"
works fine for me.
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.
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 ?
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
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.
Created attachment 30667 [details] My apache2.conf
Created attachment 30668 [details] My commonapache2.conf
Created attachment 30669 [details] Output of http://localhost/server-info
Created attachment 30670 [details] Output of http://localhost/server-status
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.
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
Created attachment 30720 [details] Output of /usr/sbin/apache2 -k start -D PHP4 -X -e Debug
Any progress on this? I still cannot get this to work.
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..
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.
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?
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).
Created attachment 32690 [details] My /etc/apache2/conf/ directory
Created attachment 32691 [details] Latest server-info
Created attachment 32692 [details] Latest server-status
Robin, What command do I need to run to get the debug output you want?
'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.
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"
Your trace command says your php file looks like this: <php phpinfo(); ?> While it should read: <?php phpinfo(); ?> Note the ? in <?php
well done to Dave Liefbroer for spotting why your code was borked. if this is still an issue once that is fixed, please reopen.