UserDirectoryPHP
|
Size: 660
Comment:
|
Size: 1142
Comment:
|
| Deletions are marked like this. | Additions are marked like this. |
| Line 1: | Line 1: |
| Warning: This procedure does not work yet. | == Introduction == This procedure installs PHP 5 and Apache 2 and configures Apache (and the shell) to run PHP scripts as CGIs. This is an alternative to using PHP as a module in Apache. |
| Line 3: | Line 4: |
| == Procedure == | |
| Line 4: | Line 6: |
| {{sudo apt-get install apache2 php5-cgi}} | {{{sudo apt-get install apache2 php5-cgi }}} |
| Line 7: | Line 10: |
| {{sudo update-binfmts --install PHP /usr/bin/php5-cgi --extension php}} | {{{sudo update-binfmts --install PHP /usr/bin/php5-cgi --extension php }}} |
| Line 9: | Line 13: |
| Enable Apache's "Actions" module. {{sudo cp /etc/apache2/mods-available/actions.* /etc/apache2/mods-enabled/actions.*}} |
Enable necessary Apache modules. {{{sudo a2enmod actions sudo a2enmod rewrite sudo a2enmod suexec sudo a2enmod include sudo a2enmod ssl}}} |
| Line 13: | Line 22: |
| {{AddType application/x-httpd-php .php}} | {{{AddType application/x-httpd-php .php }}} |
| Line 16: | Line 26: |
| {{Action application/x-httpd-php /usr/bin/php5}} | {{{Action application/x-httpd-php /cgi-bin/php5 }}} Reload the Apache configuration. {{{sudo /etc/init.d/apache2 force-reload }}} == Notes == If implemented as described, this configuration requires accessing phpMyAdmin via {{{http://localhost/phpmyadmin/index.php }}} {{{http://localhost/phpmyadmin/}}} will not work. |
Introduction
This procedure installs PHP 5 and Apache 2 and configures Apache (and the shell) to run PHP scripts as CGIs. This is an alternative to using PHP as a module in Apache.
Procedure
Install Apache 2 and PHP 5. {{{sudo apt-get install apache2 php5-cgi }}}
Configure PHP 5 to run .php scripts from the shell. {{{sudo update-binfmts --install PHP /usr/bin/php5-cgi --extension php }}}
Enable necessary Apache modules.
{{{sudo a2enmod actions sudo a2enmod rewrite sudo a2enmod suexec sudo a2enmod include sudo a2enmod ssl}}}
Enable Apache's handling of PHP files. Uncomment the following line from /etc/apache2/apache2.conf: {{{AddType application/x-httpd-php .php }}}
Add an action to handle PHP files. Add the following line beneath the one just uncommented: {{{Action application/x-httpd-php /cgi-bin/php5 }}}
Reload the Apache configuration. {{{sudo /etc/init.d/apache2 force-reload }}}
Notes
If implemented as described, this configuration requires accessing phpMyAdmin via {{{http://localhost/phpmyadmin/index.php }}} http://localhost/phpmyadmin/ will not work.