Difference between revisions of "Php"
(Created page with "== Installing php ==") |
|||
| Line 1: | Line 1: | ||
== Installing php == | == Installing php == | ||
| + | |||
| + | Before you begin, check your USE flags. My suggestion for the php package in ''/etc/portage/package.use'' is | ||
| + | dev-lang/php mysql posix session pcre curl | ||
| + | Emerge the package when you are ready. | ||
| + | '''$''' sudo emerge -av dev-lang/php | ||
| + | After the emerge has completed, you can change php's settings by editing its configuration file. | ||
| + | '''$''' sudo nano -w /etc/php/apache2-php5.3/php.ini | ||
| + | A few recommended configuration changes are as follows. Use ctrl-w to find the directives using nano. | ||
| + | magic_quotes_gpc = Off | ||
| + | session.auto_start = 1 | ||
| + | In order for apache to serve php pages, we'll need to modify its configuration file. | ||
| + | '''$''' sudo nano -w /etc/conf.d/apache2 | ||
| + | Make sure the '''APACHE2_OPTS''' variable contains the following directive: | ||
| + | -D PHP5 | ||
| + | Next restart the apache server | ||
| + | '''$''' sudo /etc/init.d/apache2 restart | ||
| + | You can create a simple php page to show php's configuration settings. If your web root home is the gentoo default ''/var/www/localhost/htdocs'', | ||
| + | '''$''' sudo -u apache nano -w /var/www/localhost/htdocs/phpinfo.php | ||
| + | Add the following to the file | ||
| + | <?phpinfo();?> | ||
| + | You can now visit http://localhost/phpinfo.php to view your php configuration in detail. | ||
Latest revision as of 09:21, 9 May 2011
Installing php
Before you begin, check your USE flags. My suggestion for the php package in /etc/portage/package.use is
dev-lang/php mysql posix session pcre curl
Emerge the package when you are ready.
$ sudo emerge -av dev-lang/php
After the emerge has completed, you can change php's settings by editing its configuration file.
$ sudo nano -w /etc/php/apache2-php5.3/php.ini
A few recommended configuration changes are as follows. Use ctrl-w to find the directives using nano.
magic_quotes_gpc = Off session.auto_start = 1
In order for apache to serve php pages, we'll need to modify its configuration file.
$ sudo nano -w /etc/conf.d/apache2
Make sure the APACHE2_OPTS variable contains the following directive:
-D PHP5
Next restart the apache server
$ sudo /etc/init.d/apache2 restart
You can create a simple php page to show php's configuration settings. If your web root home is the gentoo default /var/www/localhost/htdocs,
$ sudo -u apache nano -w /var/www/localhost/htdocs/phpinfo.php
Add the following to the file
<?phpinfo();?>
You can now visit http://localhost/phpinfo.php to view your php configuration in detail.