INTEGRATE PHP

PHP INTEGRATION

 

<SERVER>

1) Go to configuration file and in VH Section, keep “DirectoryIndex” directive as “index.php”, also add separate directive outside the VH Section, to run php.

# vim /etc/httpd/conf/httpd.conf

    <VirtualHost 192.168.0.102:80>

                ServerAdmin webmaster@dummy-host.example.com

                DocumentRoot /opt/website_directory1

                ServerName first.com

                DirectoryIndex index.php

                ErrorLog logs/dummy-host.example.com-error_log

                CustomLog logs/dummy-host.example.com-access_log common

     </VirtualHost>

     AddHandler php5-script .php

     AddType text/html .php

 

2) Now to test php page, edit “index.php” file.

     # vim index.php

                <?php phpinfo(); ?>

     :wq!

 

3) Now Install PHP.

     # yum install php

 

4) Now, find “.so” file

     # rpm –ql php

 

5) Then copy that “.so” file to apache’s module directory.

     # cp /usr/lib/httpd/modules/libphp5.so /etc/httpd/modules/

 

6) Again, go to configuration file, search for “LoadModule” and add below line.

     LoadModule php5_module modules/libphp5.so

 

7) Reload the httpd service

     # /etc/init.d/httpd reload

 

 

<CLIENT>

1) Make entry in “/etc/hosts”

     # vim /etc/hosts

            <server-ip>     first.com



2) Check website via Browser or “elinks” command.

     # elinks http://first.com

 

Comments