Using Linux, Apache, MySQL, and PHP For Application Deployment

Linux, Apache, MySQL, and PHP can all be used to produce software which runs on a web server, and thus eliminates the need for client software installations on a local computer. What this means is that the server contains both the database front end, the database back end, and the client front end all in one package. Upgrades to software based on Linux, Apache, MySQL, and PHP (LAMP) can be done with very little time involved at all, since all of the necessary software will only have to be installed one time, on one computer. In addition, LAMP software could very easily be made available to individuals who are outside of a main office. These workers would simply have to connect to a company’s VPN to run the intended software.This tutorial will cover LAMP installation on a stand alone server, which will be able to run software designed for a LAMP environment. This tutorial will also cover basic MySQL syntax, so that a server administrator can troubleshoot issues within a particular application. This tutorial already assumes that a working installation of Linux is available, and that networking is already setup on the working installation of Linux. For the sake of this tutorial, all of the LAMP components will be installed from source code when needed, and from binary packages when appropriate. This tutorial should be applicable across all distributions of Linux. The first step is to successfully install Apache.Apache Installation and ConfigurationApache can be downloaded from apache.org. In this example, Apache version 1.3.31 is used. First, create a directory on the root of your file system called src.mkdir /srcNext, move the Apache software to the /src directory, and extract it.mv apache_1.3.31.tar.gz /src
tar -xvzf apache_1.3.31.tar.gzOnce Apache is extracted to the /src/apache_1.3.31 directory (version numbering will probably differ), change to that directory, and configure the Apache HTTP server.cd apache_1.3.31
./configure –prefix=/usr/local/apache –enable-module=so
make
make installYou will definitely need the Gnu C Compiler installed (GCC), and Gnu Make (make) in order to install Apache. This compilation of Apache will take quite some time, the configure options that were passed to Apache tell the configuration script to install Apache to the /usr/local/apache directory, and to enable module support within Apache. Module support will later be used to load PHP from. Once Apache is installed, the main configuration file should be copied to /usr/local/apache/conf/httpd.conf. You can then test the web server by issuing a start command to the Apache control script, apachectl:/usr/local/apache/bin/apachectl startYou should now be able to view the default Apache page at the server’s ip address, or domain name if applicable. Since Apache is fully up and running, MySQL will be installed next.MySQL InstallationMySQL can be either installed by source, or by binary packages. Since there is no need for customization to MySQL, MySQL can be safely installed from binary packages for this step. If you are using Red Hat Linux, the RPMS you will need to download include mysql-version, mysql-server-version, and mysql-client-version. You will also need to satisfy any dependencies requested by these packages. If you run Debian, you simply will need to enter one command:apt-get install mysql-serverApt-get will then fetch the required dependencies, and install them. Once MySQL is installed, you should first create a password, and a test database. This can be accomplished by:mysql -u root -p
mysql> SET PASSWORD FOR root@localhost=PASSWORD(‘desired password’);
mysql> create database mydb;
mysql> quitOnce you have created a test database, and assigned a password to the root user, you are ready to install and configure PHP to use MySQL.PHP Installation and ConfigurationPHP will need to be installed from source code, which may be downloaded from http://www.php.net. The latest version as of this writing is 4.3.7. Move and extract PHP to the same directory used before, /src:mv php-4.3.7.tar.gz /src
cd /src
tar -xvzf php-4.3.7.tar.gz
cd php-4.3.7
./configure –with-mysql –with-apxs=/usr/local/apache/bin/apxs
make
make installOnce PHP is installed, the configuration file for PHP will need to be copied to the /usr/local/lib directory, and PHP will need to be enabled within Apache. You can safely substitute the vi command below with whatever your favorite text editor is.cp php.ini-dist /usr/local/lib/php.ini
vi /usr/local/apache/conf/httpd.confCreate the following lines, in the respective sections of httpd.conf (the proper locations will be under the [main] configuration, and generally don’t matter where they are located, but for simplicity, you should place them in the sections which are populated by similar directives).AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
LoadModule php4_module libexec/libphp4.soYou will also want to modify the DirectoryIndex value to:DirectoryIndex index.php index.htmlWhich will allow Apache to fetch the default index.php file when a directory is called which contains a file called index.php. Apache will now need to be restarted, via the apachectl script./usr/local/apache/bin/apachectl restartNext, create a file under the default document directory (default is /usr/local/apache/htdocs) called index.php, and insert the following text into it. print

VPN Software Review!

linux,apache,mysql,linux server

Advertisements