Linux apache + mysql + php development environment pure source code compilation and setup record all the processes of the apache + mysql + php development environment compiled by source code under fedoracore1 <P> it usually records all the processes of the apache + mysql + php development environment compiled by source code under fedora core 1.
Generally, installing a server with rpm is the most convenient. you can easily obtain the desired environment without considering too many configurations. However, it is not so easy to solve the issue of the Association of rpm packages. Apache, mysql, and php are simple to compile and install from source code. the configuration parameters are not complex and there is not much dependency between them, the system compiled from the source code is also relatively stable, facilitating future patching and upgrading.
The premise for compiling and installation is that the system has installed the corresponding compilation tool. Generally, when installing the system, I prefer to select a custom system and only the development kit, none of the other software packages are installed. If you do not select to install all development tools, you must 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 procedure is as follows:
1. install mysql
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 a habit of me. you can also choose another 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. server start
./Mysqladmin-uroot password 'XXX' <-- change the default password
./Mysql-uroot-p try to log on to mysql. it should be okay.
The mysql. server file can be copied to the/etc/rc. d/init. d Directory and set to automatically start the mysql service when the system starts.
2. install apache
Download a target version
Tar-xzvf httpd-2.0.xx.tar.gz
Cd httpd-2.0.xx
./Configure -- prefix =/usr/local/apache -- enable-so <-- modularization
Make
Make install
Cd/usr/local/apache/conf
Modify httpd. conf. because php will be configured later, you can configure User, Group, ServerName, DocumentRoot, and DirectoryIndex parameters for the moment.
Cd/usr/local/apache/bin
./Apachectl start apache service. enter the ip address in the browser of the client, because the default page of apache appears.
The apachectl file can also be copied to the/etc/rc. d/init. d directory to automatically start the apache service when the system starts.
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 apxs file in the apache installation path, for apache 1.3, the parameter is -- with-apxs =
Make
Make install
Copy the php. ini-recommended file in the source code directory to/usr/local/php/lib/and change it to php. ini.
Return to the apache configuration file and check whether the LoadModule php4_module modules/libphp4.so line is automatically added. Then add the following code. I usually add it after the line # AddHandler cgi-script. cgi.
AddType application/x-httpd-php. php
Use apachectl to restart the apache service
./Apachectl restart
In the configured DocumentRoot Directory, add a phpinfo. php file to test the system. The program code is as follows:
// Filename: phpinfo. php
Phpinfo ();
?>
In this case, the parameter table of php should appear when accessing http: // serverip/phpinfo. php in the client browser. at this point, all the systems have been installed.
Of course there are some details to consider, such
/Usr/local/mysql/bin
/Usr/local/apache/bin
/Usr/local/php/bin
Add the three directories to the system PATH so that all operation commands can be executed in any PATH.
Configure the php. ini file and set include_path to include_path = ".:/usr/local/php/lib/php". then you can use the pear code base in the code.
The above is the basic and simplest configuration of the three applications. if additional extension functions are required. the parameters following/configure are configured. for specific configuration formats, refer to their respective. /configure -- help menu.
We recommend that you keep the source code directory. in this way, you only need to modify the configure parameter, make, make install, and restart the service to update the configuration.