Apache not interpreting PHP
am 10.05.2007 16:57:34 von mylek
So I have a new Gentoo server running. I emerged Apache and dev-lang/
PHP, went to emerge mod_php and portage couldn't find it. Since that
had always been the easiest way to get PHP working, I had to spend
some time researching the issue. Appearantly, Apache just needed to be
compiled with a few USE flags, and allegedly it would include PHP
support. Mine did not. So I kept looking, and ran across about 10
different "guides" none of which worked. Some seem to have been
written for older versions of Gentoo and Apache. I ran across
mod_suphp which I can't get emerged because it seems that Gentoo wants
to just ignore my changes to portage.unmask and portage.keyword. I got
to the point where the Apache_OPTS could not load -D PHP5 because it
could not find libphp5.so. I looked and could not find that.
I am running the latest versions of Gentoo, Apache, and PHP5. A simple
phpinfo() script just dumps the PHP code out in the browser, without
interpreting it. Does anyone know of a surefire, 99% accurate, works
almost every single time, method of getting Apache and PHP5 integrated
on Gentoo? What happened to mod_php anyway? (If I don't find an answer
soon, I am going to be forced to just use Xampp.)
Re: Apache not interpreting PHP
am 11.05.2007 01:47:49 von Johnny
"Jerim79" wrote in message
news:1178809054.691200.282670@l77g2000hsb.googlegroups.com.. .
> So I have a new Gentoo server running. I emerged Apache and dev-lang/
> PHP, went to emerge mod_php and portage couldn't find it. Since that
> had always been the easiest way to get PHP working, I had to spend
> some time researching the issue. Appearantly, Apache just needed to be
> compiled with a few USE flags, and allegedly it would include PHP
> support. Mine did not. So I kept looking, and ran across about 10
> different "guides" none of which worked. Some seem to have been
> written for older versions of Gentoo and Apache. I ran across
> mod_suphp which I can't get emerged because it seems that Gentoo wants
> to just ignore my changes to portage.unmask and portage.keyword. I got
> to the point where the Apache_OPTS could not load -D PHP5 because it
> could not find libphp5.so. I looked and could not find that.
>
> I am running the latest versions of Gentoo, Apache, and PHP5. A simple
> phpinfo() script just dumps the PHP code out in the browser, without
> interpreting it. Does anyone know of a surefire, 99% accurate, works
> almost every single time, method of getting Apache and PHP5 integrated
> on Gentoo? What happened to mod_php anyway? (If I don't find an answer
> soon, I am going to be forced to just use Xampp.)
>
I have both php4 and 5 running under gentoo hardened let me look to see what
I did...
here's what I used as a reference:
http://www.gentoo.org/proj/en/php/php4-php5-configuration.xm l
ok here's my package.use entry for php5:
=dev-lang/php-5* cgi force-cgi-redirect crypt ssl zlib apache2 bcmath
calendar cli ctype curl filter gd ldap mysql mysqli odbc pcre postgres
session simplexml soap sockets tidy tokenizer unicode xml xsl
and here's the emerge
# time emerge '=dev-lang/php-4*' '=dev-lang/php-5*' > phpEmerge4.log
....
real 24m29.941s
user 25m58.560s
sys 9m8.550s
here's my /etc/apache2/modules.d/php4-cgi.conf
# handler for PHP 4 scripts
ScriptAlias /php4-cgi /usr/lib/php4/bin/php-cgi
Action php4-cgi /php4-cgi
AddHandler php4-cgi .php4 .php3 .php .phtml
and here's the /etc/apache2/modules.d/php5-cgi.conf
# handler for PHP 5 scripts
ScriptAlias /php5-cgi /usr/lib/php5/bin/php-cgi
Action php5-cgi /php5-cgi
AddHandler php5-cgi .php5
and in /etc/apache2/modules.d/70_mod_php.conf:
# Load the module first
LoadModule php4_module modules/libphp4.so
# Set it to handle the files
AddType application/x-httpd-php .php
AddType application/x-httpd-php .phtml
AddType application/x-httpd-php .php3
AddType application/x-httpd-php .php4
AddType application/x-httpd-php-source .phps
AddDirectoryIndex index.php index.phtml
and in /etc/apache2/modules.d/70_mod_php5.conf:
# Load the module first
LoadModule php5_module modules/libphp5.so
# Set it to handle the files
AddType application/x-httpd-php .php
AddType application/x-httpd-php .phtml
AddType application/x-httpd-php .php3
AddType application/x-httpd-php .php4
AddType application/x-httpd-php .php5
AddType application/x-httpd-php-source .phps
AddDirectoryIndex index.php index.phtml
and here's /etc/conf.d/apache2
APACHE2_OPTS="-D DEFAULT_VHOST -D SSL_DEFAULT_VHOST -D CGI -D PHP5CGI -D
PHP4 -D SSL"
and it just works like the guide said.
Johnny