Linux under the apache+mysql+php development Environment Pure source code compilation build

Source: Internet
Author: User
Tags add file copy ini mysql php file php development environment phpinfo version
apache|mysql| Compile | Source code record the entire process of the apache+mysql+php development environment that I compiled from the source code under Fedora Core 1

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

The prerequisite for compiling the installation is that the system already has the appropriate compilation tools installed, and it is generally my custom to select a custom system when installing the system and to select only the development kit, all other packages are not installed. If you have not chosen to install all the development tools, then you need to install at least the following RPM package

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

The steps below are described

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 my custom, you can also choose other 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 ' <--modify the default password
./mysql-uroot-p try to login to MySQL, there should be no problem

Mysql.server This file can be copy to the/ETC/RC.D/INIT.D directory, set the system to start automatically when 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 up, the main configuration user,group,servername,documentroot,directoryindex these parameters can be
Cd/usr/local/apache/bin
/apachectl start starts the Apache service, which then enters IP in the client browser to see the Apache default page appear

Apachectl This file can also be copy to the/ETC/RC.D/INIT.D directory, set up the system to start automatically when the 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 argument is--with-apxs=.
Make
Make install
The source directory php.ini-recommended this file copy to/usr/local/php/lib/, renamed to PHP.ini
Return to the Apache configuration file to confirm that the LoadModule php4_module modules/libphp4.so line is automatically added. Then add the following code, and I'm generally accustomed to adding it behind the #addhandler Cgi-script. CGI line.
AddType application/x-httpd-php. php

Restarting the Apache service with Apachectl
./apachectl Restart

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

?
filename:phpinfo.php
Phpinfo ();
?>

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

Of course, there are some details to consider, such as the
/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 on any path

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

These are the basic minimalist configurations for these three applications and, if additional extensions are required, are configured in the parameters that follow the./configure, and the specific configuration can refer to the respective./configure--help Help menu.

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



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.