Search:  
Gentoo Wiki

Apache_Modules_mod_php

Apache2 Series


Main


Modules


Addons & Tunnels


Tips


Configuring


Other

edit
Image:Php.gif

Prerequsites

USE Flags

PHP has a lot of USE flags to choose from, for most users the default is sufficient, however you may want to add more. USE flags for dev-lang/php

When adding USE flags for PHP it is best to include them in your /etc/make.conf or your /etc/portage/package.use file.

Installing

To install PHP: (This will install mod_php, if you want the CLI version as well just add cli below in package.use)

First add dev-lang/php apache2 to /etc/portage/package.use. (There is very simple tool for adding use flags to every package in package.use file. emerge flagedit )

 flagedit dev-lang/php apache2

Then run

 emerge dev-lang/php

This can take a very long time on a slower system.

Apache

File: /etc/conf.d/apache2
APACHE2_OPTS="-D DEFAULT_VHOST -D PHP5"

Restart apache after making these changes so that they take effect by issuing: /etc/init.d/apache2 restart

Testing

Sample phpinfo output
Sample phpinfo output

A simple php page with the following code should help you to test your PHP configuration

File: /var/www/localhost/htdocs/phpinfo.php
<?php phpinfo(); ?>

And now open your little phpinfo-File with your Browser over your apache. http://localhost/phpinfo.php

Surfing to this page should yield a nice informational page about your PHP installation.


Tip: If you get a web page with a Permission denied error in the rendered text and not a nice information page you may need to adjust the permissions on this file.

Links

Related Articles

Retrieved from "http://www.gentoo-wiki.info/Apache_Modules_PHP"

Last modified: Fri, 03 Oct 2008 03:12:00 +0000 Hits: 55,425