Linux apache+mysql+php Development Environment Pure Source code compilation and construction

Source: Internet
Author: User
Tags php development environment phpinfo

Linux apache+mysql+php Development Environment Pure Source code compilation and construction

Document the entire process of the apache+mysql+php development environment that I compiled from source code under Fedora Core 1

Usually installing a server is the most convenient way to use RPM, and you can easily get the environment you need without having to consider too many configuration issues. However, the problem of the RPM package is not so easy to solve. Apache,mysql,php these three applications from the source code to compile the installation or relatively simple, configuration parameters are not complicated, and there is not too much dependency, compiled from the source of the system is more stable, convenient for future patching and upgrading work. 

The prerequisite for compiling the installation is that the system has installed the appropriate compilation tools, generally my habit is to install the system, the choice of custom system and only select the development Kit, all other packages are not installed. If you do not have the option to install all of the development tools, then you need to install at least the following RPM packages

autoconf-2.57-3.noarch.rpm 
automake-1.7.8-1.noarch.rpm 
binutils-2.14.90.0.6-3.i386.rpm 
bison-1.875-5.i386.rpm 
byacc-1.9-26.i386.rpm 
cpp-3.3.2-1.i386.rpm 
flex-2.5.4a-30.i386.rpm 
gcc-3.3.2-1.i386.rpm 
gcc-c++-3.3.2-1.i386.rpm 
glibc-devel-2.3.2-101.i386.rpm 
glibc-headers-2.3.2-101.i386.rpm 
glibc-kernheaders-2.4-8.36.i386.rpm 
libstdc++-devel-3.3.2-1.i386.rpm 
m4-1.4.1-14.i386.rpm 

Here are the steps 

1. mysql Installation 
Download a target version 
TAR-XZVF mysql-4.0.xx.tar.gz 
CD mysql-4.0.xx 
./configure--prefix=/usr/local/mysql <--This path is something I'm used to, you can also choose a different installation path 
Make 
Make install 
In the Support-files directory, select an appropriate. cnf file, CP to/ETC/MY.CNF 
Cd/usr/local/mysql/bin 
./mysql_install_db 
.. /share/mysql/mysql.server start 
./mysqladmin-uroot password ' xxxx ' <--change the default password 
/mysql-uroot-p try to log in to MySQL, there should be no problem. 

Mysql.server This file can be copied to the/ETC/RC.D/INIT.D directory, set the system start automatically start the MySQL service 

2. Apache Installation 
Download a target version 
TAR-XZVF httpd-2.0.xx.tar.gz 
CD httpd-2.0.xx 
./configure--prefix=/usr/local/apache--enable-so <--Modular 
Make 
Make install 
Cd/usr/local/apache/conf 
Modify httpd.conf, because in a moment also to configure PHP, here can be briefly set, the main configuration user,group,servername,documentroot,directoryindex these parameters can be 
Cd/usr/local/apache/bin 
./apachectl start to launch Apache service, this time in the client browser input IP, because you can see the Apache default page appears 

Apachectl This file can also be copied to the/ETC/RC.D/INIT.D directory, set the system to start automatically start Apache service 


3. PHP Installation 
Download a target version 
TAR-XZVF php-4.3.xx.tar.gz 
CD php-4.3.xx 
./configure--prefix=/usr/local/php--with-apxs2=/usr/local/apache/bin/apxs <--Here you need to find the Apache installation path APXS this file, If it's Apache version 1.3, the parameter is--with-apxs=. 
Make 
Make install 
Copy the php.ini-recommended file from the source directory to/usr/local/php/lib/and change the name to PHP.ini 
Go back to the Apache configuration file and verify that the LoadModule Php4_module modules/libphp4.so line is added automatically. Then add the following code, which I generally used to add after the #addhandler cgi-script. CGI line. 
AddType application/x-httpd-php. php 

Restarting the Apache service with Apachectl 
./apachectl Restart 

In the Set DocumentRoot directory, add a phpinfo.php file to test the system, the program code is as follows:

filename:phpinfo.php 
Phpinfo (); 
?>

This time in the client browser access http://serverip/phpinfo.php should appear in the PHP parameter table, so that all systems installed. 

There are, of course, some details to consider, such as 
/usr/local/mysql/bin 
/usr/local/apache/bin 
/usr/local/php/bin 
Three directories are added to the path of the system so that all operation instructions can be executed in any path. 

Configure the php.ini file to set Include_path to Include_path = ".:/ Usr/local/php/lib/php "so that you can use the Pear code base in your code. 

These are the basic simplest configurations of these three applications, and if additional extensions are required, they are configured in the parameters later in the./configure, and the configuration can be referenced in the respective./configure--help Help menu. 

It is recommended to keep the source directory, so that when you need to add an extension, you only need to modify the Configure parameter, and make, do install, restart the service, you can update. 

Linux apache+mysql+php Development Environment Pure Source code compilation and construction

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.