Web server address - Chapter 23 . Running a Linux, Apache, MySQL,

Chapter 23 . Running a Linux, Apache, MySQL, and PHP (LAMP) Server 599 This installation process installs Apache version 1.3, and all the configuration examples here have been tested against it. If you would rather install Apache 2.0, it is available in the apache2-mpm-prefork package and uses libapache2-mod-php4 instead of the php4 package mentioned later in this chapter. The server should automatically start once the installation is finished, which means that you re now ready to install PHP. Installing PHP Now you re ready to install and test the PHP module in Apache. This is the most common method for installing PHP but introduces some security concerns on multiuser systems because all PHP scripts will be run as the same user as the Apache daemon. Be sure to read the Security section of the PHP manual at http://php.net/ manual/en/security.php before granting other users access to manipulate PHP files on your server. The PHP Apache module is contained in the php4 package, which is installed using APT. The following lines download and install the module and the mysql extensions, configure Apache to load the module automatically, and instruct Apache to reload its configuration: # apt-get install php4 php4-mysql # apache-modconf apache enable mod_php4 Replacing config file /etc/apache/modules.conf with new version # apachectl restart Don t worry if the second line does not print out a message as this example shows. That simply means that the module has already been configured. At this point, Apache should be ready to process HTTP requests, complete with processing of PHP files. To test it, create a file named /var/www/info.php containing a call to the phpinfo() function: # cat > /var/www/info.php ^D # chmod 644 /var/www/info.php The ^D means that you should press Ctrl+D on your keyboard. This tells the cat command that you are at the end of the input. Now try opening the page by going to http://your server s address/info.php. You should see a page full of information about your Apache and PHP installation, as shown in Figure 23-1. Note
Searching for affordable and proven webhost to host and run your servlet applications? Go to Linux Web Hosting services and you will find it.

Leave a Reply