# Apache+PHP=no work

## swizec

I had a working set up but updated php and apache. I added the stuff htat is needed in apache.conf and whenever I try seeing a php page it just wants to downlaod the script. I've tried everythign I could think of, even rolling back to the previous versions of php and apache and the problem persists.

What could I still do to get php working?

----------

## jmbsvicetto

Hi.

This problem can be caused by several different issues. As you didn't provide enough detail, for the moment check if your php was built with support for apache.

----------

## swizec

Yes php was built with support for apache and I have the "-D PHP" thing in apache.conf

----------

## pilla

What are the versions that you are using? 

Anything useful in the logs?

----------

## swizec

The output of "emerge -p php apache"

```

[ebuild     U ] net-www/apache-2.2.4-r4 [2.0.59-r2]

[ebuild     U ] dev-lang/php-5.2.2-r1 [5.1.6-r11]

```

And there are no errors reported in the logs.

----------

## pilla

 *swizec wrote:*   

> The output of "emerge -p php apache"
> 
> ```
> 
> [ebuild     U ] net-www/apache-2.2.4-r4 [2.0.59-r2]
> ...

 

Maybe you should try this upgrade...  be sure that php has the apache2 use flag turned on. Please post the output of

```

emerge -upv php apache

```

----------

## swizec

```

[ebuild     U ] sys-libs/zlib-1.2.3-r1 [1.2.3] USE="(-build%)" 416 kB

[ebuild     U ] dev-libs/openssl-0.9.8e [0.9.7i] USE="zlib -bindist -emacs -sse2% -test" 3,264 kB

[ebuild     U ] sys-devel/libtool-1.5.23b [1.5.22] 2,846 kB

[ebuild     U ] net-nds/openldap-2.3.35-r1 [2.2.28-r4] USE="berkdb crypt debug gdbm ipv6 kerberos perl readline samba slp* ssl tcpd -minimal -odbc -overlays% -sasl (-selinux) -smbkrb5passwd%" 3,707 kB

[ebuild     U ] media-libs/libpng-1.2.18 [1.2.12] USE="doc" 735 kB

[ebuild     U ] app-crypt/mit-krb5-1.5.2-r2 [1.4.3] USE="doc ipv6 -krb4 -tcl% (-berkdb%*) (-static%) (-tcltk%) (-tetex%)" 9,857 kB

[ebuild     U ] sys-libs/gdbm-1.8.3-r3 [1.8.3-r2] USE="berkdb" 224 kB

[ebuild  N    ] dev-db/mysql-init-scripts-1.2  0 kB

[ebuild     U ] dev-libs/libpcre-7.0 [6.6] USE="doc unicode%*" 594 kB

[ebuild     U ] dev-libs/expat-2.0.0 [1.95.8] USE="(-test%)" 441 kB

[ebuild     U ] sys-devel/gnuconfig-20070118 [20051223] 40 kB

[ebuild     U ] app-misc/mime-types-7 [5] 7 kB

[ebuild     U ] media-libs/freetype-2.3.4-r2 [2.1.10-r2] USE="X%* debug%* doc zlib -bindist" 1,542 kB

[ebuild     U ] sys-libs/readline-5.2_p4 [5.1_p4] 1,996 kB

[ebuild     U ] dev-libs/libmcrypt-2.5.8 [2.5.7] 1,304 kB

[ebuild     U ] media-libs/jpeg-6b-r8 [6b-r7] 621 kB

[ebuild     U ] app-arch/bzip2-1.0.4 [1.0.3-r5] USE="-static (-build%)" 822 kB

[ebuild     U ] dev-libs/libxml2-2.6.28 [2.6.27] USE="debug doc ipv6 python readline -test" 4,606 kB

[ebuild     U ] dev-java/java-config-wrapper-0.13 [0.12-r1] 7 kB

[ebuild     U ] mail-mta/sendmail-8.14.1 [8.13.8] USE="ipv6 ldap sockets ssl tcpd -mailwrapper -mbox -nis -sasl" 2,014 kB

[ebuild     U ] sys-devel/m4-1.4.9 [1.4.8] USE="nls -examples%" 596 kB

[ebuild     U ] app-text/aspell-0.60.5 [0.60.4] USE="gpm nls" 1,714 kB

[ebuild     U ] sys-libs/ncurses-5.6-r1 [5.5-r2] USE="debug doc gpm unicode -bootstrap -build -minimal -nocxx -trace%" 2,353 kB

[ebuild     U ] net-www/apache-2.2.4-r4 [2.0.59-r2] USE="debug doc ldap ssl threads -mpm-event% -mpm-itk -mpm-peruser -mpm-prefork -mpm-worker -no-suexec% (-selinux) -static-modules (-apache2%*) (-mpm-leader%) (-mpm-threadpool%)" 0 kB

[ebuild     U ] dev-db/mysql-5.0.40 [5.0.19-r1] USE="berkdb debug perl ssl -big-tables -cluster -embedded -extraengine -latin1% -max-idx-128 -minimal (-selinux) -static (-srvdir%)" 23,533 kB

[ebuild     U ] dev-java/java-config-2.0.33-r1 [2.0.30] 25 kB

[ebuild  NS   ] sys-libs/db-4.5.20_p2  USE="doc java -bootstrap -nocxx -tcl -test" 9,068 kB

[ebuild  N    ] app-admin/apache-tools-2.2.4-r3  USE="ssl" 0 kB

[ebuild     U ] dev-lang/php-5.2.2-r1 [5.1.6-r11] USE="apache2 bcmath berkdb bzip2 calendar cgi cli crypt debug doc flatfile ftp gd gdbm iconv ipv6 kerberos ldap mysql ncurses nls pcre posix readline reflection session simplexml sockets spell spl ssl threads tokenizer truetype unicode xml xmlreader xmlrpc xmlwriter xsl zip zlib -adabas -birdstep -cdb -cjk -concurrentmodphp -ctype -curl -curlwrappers -db2 -dbase -dbmaker -discard-path -empress -empress-bcs -esoob -exif -fastbuild -fdftk -filter -firebird -force-cgi-redirect -frontbase -gd-external -gmp -hash -imap -inifile -interbase -iodbc -java-external -json% -ldap-sasl -libedit -mcve -mhash -msql -mssql -mysqli -oci8 -oci8-instant-client -odbc -pcntl -pdo -pdo-external -pic -postgres -qdbm -recode -sapdb -sharedext -sharedmem -snmp -soap -solid -sqlite -suhosin -sybase -sybase-ct -sysvipc -tidy -wddx -xpm -yaz -zip-external% (-filepro%) (-hyperwave-api%) (-informix%) (-memlimit%) (-ming%)" 0 kB

[ebuild     U ] app-doc/php-docs-20070202-r1 [20050822] 3,345 kB

[blocks B     ] dev-php5/pecl-zip (is blocking dev-lang/php-5.2.2-r1)

```

So I should just run this and hope everything works?

----------

## pilla

 *swizec wrote:*   

> 
> 
> So I should just run this and hope everything works?

 

Your choice, although you could try to only emerge php and apache.

----------

## swizec

I ran that command and it screwed up my libexpat so I emerged the older version of that instead of rebuilding the whole system.

Any idea why all my fonts are different than they used to be in KDE?

Anyway, the apache+php now produces a lovely text output of the php script when there is this in /etc/conf.d/apache2

```

APACHE2_OPTS="-D DEFAULT_VHOST -D INFO -D LANGUAGE -D MANUAL -D SSL -D SSL_DEFAULT_VHOST -D SUEXEC"

or

APACHE2_OPTS="-D DEFAULT_VHOST -D INFO -D LANGUAGE -D MANUAL -D SSL -D SSL_DEFAULT_VHOST -D SUEXEC -D PHP"

```

And it wants to download the code when there's this:

```

APACHE2_OPTS="-D DEFAULT_VHOST -D INFO -D LANGUAGE -D MANUAL -D SSL -D SSL_DEFAULT_VHOST -D SUEXEC -D PHP -D PHP5"

or

APACHE2_OPTS="-D DEFAULT_VHOST -D INFO -D LANGUAGE -D MANUAL -D SSL -D SSL_DEFAULT_VHOST -D SUEXEC -D PHP5"

```

:/

----------

## jmbsvicetto

swizec,

when you get an error with libexpat, you really need to run revdep-rebuild to fix that. The problem was probably caused by having -D PHP instead of -D PHP5 in /etc/conf.d/apache2.

----------

## swizec

Running that revdep-rebuild would re-emerge about 90% of the stuff on the system, I don't have time to wait 3 days for KDE and stuff to re-emerge.

And if you say the problem was caused by having -D PHP instead of -D PHP5 then why doesn't it work in either case?

----------

## RaZoR1394

Hi I had one of the problems you were having more precisely only the php source was visible when opening php files. My options line in /etc/conf.d/apache2 only had "-D PHP". With "-D PHP5" Apache would not start. After reemerging php with new use flags it finally works. The ebuild also auto updated my apache2 conf file to this:

 *Quote:*   

> 
> 
> # /etc/conf.d/apache2: config file for /etc/init.d/apache2
> 
> # When you install a module it is easy to activate or deactivate the modules
> ...

 

----------

## babazaroni

I'm having the same problem, after doing an upgrade, where I see php source instead of running php when I load a php link.

I had mod_php in my make.conf USE flag.

This does not seem to be used anymore.  Should I use 'php' or 'php5' then re-emerge Apache2?

Thanks!

----------

## alienjon

Hmm, same issue here. Only happened after a recent upgrade, so something about php changed. For me, I can start apache just fine but the php is read literally and isn't parsed whatsoever, printing some of the code into the webpage. I tried PHP and PHP5 in my /etc/conf.d/apache2 file but no change there either. I already ran a revdep-rebuild and everything came out clean (I also tried some different use flags for php (apache looks fine) but still the same. Here's my php and apache info:

```

dev-lang/php-5.2.2-r1  USE="apache2 berkdb bzip2 calendar cdb cli crypt ctype exif ftp gd gdbm iconv imap ipv6 ldap mysql mysqli ncurses nls pcre posix readline reflection session sharedext simplexml soap sockets spell spl sqlite ssl threads tidy tokenizer truetype unicode xml xmlrpc xsl zip zlib (-adabas) -bcmath (-birdstep) -cgi -cjk -concurrentmodphp -curl -curlwrappers -db2 -dbase (-dbmaker) -debug -discard-path -doc (-empress) (-empress-bcs) (-esoob) -fastbuild (-fdftk) -filter (-firebird) -flatfile -force-cgi-redirect (-frontbase) -gd-external -gmp -hash -inifile -interbase -iodbc -java-external -json -kerberos -ldap-sasl -libedit -mcve -mhash -msql -mssql -oci8 (-oci8-instant-client) -odbc -pcntl -pdo -pdo-external -pic -postgres -qdbm -recode -sapdb -sharedmem -snmp (-solid) -suhosin (-sybase) (-sybase-ct) -sysvipc -wddx -xmlreader -xmlwriter -xpm -yaz -zip-external" 0 kB

[ebuild   R   ] net-www/apache-2.0.58-r2  USE="apache2 ssl threads -debug -doc -ldap -mpm-itk -mpm-leader -mpm-peruser -mpm-prefork -mpm-threadpool -mpm-worker (-selinux) -static-modules" 0 kB

```

I'm going to try syncing portage and seeing if anything new comes up.

----------

## alienjon

Updating my system didn't do anything. I bet it's a setting somewhere that I missed (maybe in php.ini?) I'm actually about to go into windows to play a game for a little bit, so I'll have to restart. I'll see if that does anything or not.

----------

## alienjon

OK, I'm dumb. Figured out the problem on my end. I had been testing this one, simple PHP file on my computer and kept opening it as a file instead of through 'localhost'. It was late + I was tired = I do dumb stuff. Anyway, it was working fine all along, I was just accessing it incorrectly.

----------

