Tutorial on installing MySql + Apache2 + PHP5.3.1 in Linux
Download the following three necessary software
01-04php-5.3.1.tar.gz.html "> download the php-5.3.1.tar.gz installation package
Download the 01-04httpd-2.2.14.tar.gz installation package
01-04mysql-5.1.42-linux-i686-glibc23.tar.gz.html "> mysql-5.1.42-linux-i686-glibc2
1. Install apache2 ---------------------------------
1. tar-zvxf httpd-2.2.14.tar.gz
2. cd httpd-2.2.14
3../configure-enable-modules = so-enable-rewrite
4. make
5. make install
6./usr/local/apache2/bin/apachectl-k start // start apahce
View [url] http: // localhost [/url] in the browser. After you get it works, apache is configured successfully.
7./usr/local/apache2/bin/apachectl-k stop // stop apache
8. After apache is successfully installed and started, it does not automatically start apache after the machine is restarted. You need to manually start apache and set the random startup execution command: echo "/usr/local/apache2/bin/apachectl">/etc/rc. d/rc. local: The command attaches the "/usr/local/apache2/bin/apachectl" string to rc. the last line of the local file, rc. local is a scripts file to be executed after linux is started successfully.
9. Install apache2 and modify/usr/local/apache/conf/httpd. conf does not take effect, which is probably because the system uses the default httpd installation (the default httpd configuration file is:/etc/httpd/conf/httpd. conf ). Run the command rpm-e httpd to uninstall the default httpd installation. If there is a dependency, you cannot unmount it with the parameter-nodeps.
Command:
Rpm-e httpd -- nodeps (if you want to uninstall the httpd of the system, run it)
Tar-zvxf httpd-2.2.14.tar.gz
Cd httpd-2.2.14
./Configure -- enable-modules = so -- enable-rewrite
Make
Make install
/Usr/local/apache2/bin/apachectl start
Echo "/usr/local/apache2/bin/apachectl">/etc/rc. d/rc. local
Ii. Install MySql ---------------------------------
1. Unzip the mysql-5.1.42-linux-i686-glibc23.tar.gz file (i686 is a 32-bit operating system, glibc23 is the compiled binary file, decompress it to use), copy the generated folder to/usr/local/mysql, and switch to the directory
2. sudo groupadd mysql-> Create a mysql user group
3. sudo useradd-g mysql-> Create a mysql user and add it to the mysql user group.
4. sudo chown-R mysql. -> set all mysql files to mysql users and sudo chgrp-R mysql. -> set all groups of all mysql files to the mysql user group (after completing this step, go to the data directory and run the "ll" command to view the owner and group of all files, if any of them does not belong to mysql, execute this step again in the data directory)
6. execute scripts/mysql_install_db-> Create a MySQL database instance.
7. Copy mysql. server under/usr/local/mysql/support-files/to/etc/init. d/and name it mysqld.
8. Copy the my-medium.cnf under/usr/local/mysql/support-files/to/etc/and name it my. cnf
9. You can use service mysqld start to start the mysql service. After the mysql service is started, run the netstat-atln command to check that port 3306 is occupied.
10. the root user of MySQL has no password by default. You can set the initial password through/usr/local/mysql/bin/mysqladmin-u root password "new password.
Command:
Tar-zxvf mysql-5.1.42-linux-i686-glibc23.tar.gz
Cp-a mysql-5.1.42-linux-i686-glibc23/usr/local/mysql
Cd/usr/local/mysql
Groupadd mysql
Useradd-g mysql
Chown-R mysql.
Chgrp-R mysql.
Scripts/mysql_install_db
Cp/usr/local/mysql/support-files/mysql. server/etc/init. d/mysqld
Cp/usr/local/mysql/support-files/my-medium.cnf/etc/my. cnf
Service mysqld start
Netstat-atln
/Usr/local/mysql/bin/mysqladmin-u root password "1q2w3e"
3. Install PHP5.3.1 ---------------------------------
1. Extract tar-zvxf php-5.3.1.tar.gz
2. cd php-5.3.1 switch directory
3,./configure-with-apxs2 =/usr/local/apache2/bin/apxs-with-mysql =/usr/local/mysql
4. make
5. make install
6. cp php. ini-development/usr/local/php5/lib/php. ini
Command:
Tar-zvxf php-5.3.1.tar.gz
Cd php-5.3.1
./Configure -- with-apxs2 =/usr/local/apache2/bin/apxs -- with-mysql =/usr/local/mysql
Make
Make install
Cp php. ini-development/usr/local/lib/php. ini
4. reconfigure apache2 to support php ---------------------------------
Cd/usr/local/apache2/conf
Vim httpd. conf
Add LoadModule php5_module modules/libphp5.so
Add AddType application/x-httpd-php. php
Or
<FilesMatch. php $>
SetHandler application/x-httpd-php
</FilesMatch>