Purpose : Enable php engine in apache
OS Environement : Linux [RHEL, Centos]
Application : php, apache httpd
Prerequisites : Make sure php is installed in the system first.
Implementation Steps :
1. Locate libphp5.so
In most of cases, libphp5.so will be present inside /etc/httpd/modules
2. Add following in httpd.conf :
# Use for PHP 5.x:
LoadModule php5_module modules/libphp5.so
AddHandler php5-script .php
# Add index.php to your DirectoryIndex line:
DirectoryIndex index.html index.php
AddType text/html .php
# PHP Syntax Coloring
# (optional but useful for reading PHP source for debugging):
AddType application/x-httpd-php-source phps
3. Restart apache web server :
$ /etc/init.d/httpd restart
4. Verification :
$ httpd -t|grep -i php
5. Create a php file inside web directory. Put the following content in that file like :
vi info.php
phpinfo();
?>
6. Access the file through browser like http://localhost/info.php. If it shows all the enables php directives or modules then php works fine.
OS Environement : Linux [RHEL, Centos]
Application : php, apache httpd
Prerequisites : Make sure php is installed in the system first.
Implementation Steps :
1. Locate libphp5.so
In most of cases, libphp5.so will be present inside /etc/httpd/modules
2. Add following in httpd.conf :
# Use for PHP 5.x:
LoadModule php5_module modules/libphp5.so
AddHandler php5-script .php
# Add index.php to your DirectoryIndex line:
DirectoryIndex index.html index.php
AddType text/html .php
# PHP Syntax Coloring
# (optional but useful for reading PHP source for debugging):
AddType application/x-httpd-php-source phps
3. Restart apache web server :
$ /etc/init.d/httpd restart
4. Verification :
$ httpd -t|grep -i php
5. Create a php file inside web directory. Put the following content in that file like :
vi info.php
phpinfo();
?>
6. Access the file through browser like http://localhost/info.php. If it shows all the enables php directives or modules then php works fine.
No comments:
Post a Comment