Running and Coding
After the first boot when installation has just finished. Linux will properly initialize all the necessary components to their rightful places for proper operations. The first testing is to run the Apache web server by issuing the command service apache start at the command prompt with a root or a superuser privileges. Then, open a browser and type the address as localhost . When the screen displays a web page that says It works and a bunch of information about Apache, the web server is up and running.
That is two components that are already working. To make the MySQL Database Server work, just issue the command service mysqld start. To be able to check whether the database service is working, there are two ways to do it. First, at the command prompt enter the following command with its corresponding parameters: mysql -h localhost -u root -p , press enter when prompted for a password. If the prompt changes to a MySQL prompt, then the database server works. Another method that can be uses to check if MySQL is running will be issuing a telnet command like this: telnet localhost 3306. If it is connected to the MySQL port (3306), then the database server is running. At this point, please be sure that Apache has loaded the PHP module for the web server to use PHP coding for generating a dynamic webpage. To do it, simply write the PHP code as follows:
Save it as index.php from a text editor, and then place the sample php file in the document directory of the web site, which in our case can be found at /var/www/html. Once the file has been placed to that directory, open a browser and enter the address http://localhost/index.php. The result should be the same as in screen shot below. At this point, the PHP module has now been loaded as part of Apache web server. After that, a developer can start coding in PHP to create dynamic and attractive web pages. And all it takes is the following acronym to remember: LAMP.