Home >Backend Development >PHP Tutorial >Mysql+Apache2+php5 installation_PHP tutorial
Download the following files to /usr/local/src/
apache (the most popular WEB server platform on Unix platform) 2.tar.gz
MySQL (the best combination with PHP)-5.0.22.tar.gz
php (as the current mainstream development language)-5.1.2.tar.gz
Unzip:
#tar xvz (parallels virtual row platform) f apache (the most popular WEB server platform on Unix platform) 2.tar.gz
#tar xvz (parallels virtual row platform) f MySQL (the best combination with PHP)-5.0.22.tar.gz
#tar xvz (parallels virtual row platform) f php (as the current mainstream development language)-5.1.2.tar.gz
#cd .. //Create a folder in the /usr/local/ directory
# mkdir apache (the most popular WEB server platform on Unix platform)
# mkdir MySQL (the best combination with PHP)
# mkdir php (as the current mainstream development language)
//MySQL (the best combination with PHP) installation process
#cd ../MySQL (The best combination with PHP) //Find the /usr/local/MySQL (The best combination with PHP) folder
#groupadd MySQL (the best combination with PHP)
#usseradd -g MySQL (The best combination with PHP) MySQL (The best combination with PHP)
#cd ../MySQL (The best combination with PHP)-5.0.22 //Find the /usr/local/src/MySQL (The best combination with PHP)-5.0.22 folder
#./configure --prefix=/usr/local/MySQL (the best combination with PHP) --localstatedir=/var/lib/MySQL (the best combination with PHP)/ --with-client-ldflags =-all-static --with-MySQL (the best combination with PHP) d-ldflags=-all-static --with-MySQL (the best combination with PHP) d-user=MySQL (the best combination with PHP) the best combination) --enable-assembler --with-extra-charsets=all
#make ; make install
/usr/local/MySQL (The best combination with PHP)/bin/MySQL (The best combination with PHP)_install_db //Initialize MySQL (The best combination with PHP)
//Configure MySQL (the best combination with PHP)
#chown –R root /usr/local/MySQL (the best combination with PHP)
#chown –R MySQL (The best combination with PHP) /var/lib/MySQL (The best combination with PHP)/
#chgrp –R MySQL (The best combination with PHP) /usr/local/MySQL (The best combination with PHP)
#cp support-files/my-medium.cnf /etc/my.cnf
/usr/local/MySQL (The best combination with PHP)/bin/MySQL (The best combination with PHP) d_safe –user=MySQL (The best combination with PHP) & //Start MySQL (the best combination with PHP) The best combination)
/usr/local/MySQL (the best combination with PHP)/bin/MySQL (the best combination with PHP) admin –u root –p password 123 //Change the password to 123
enter password:
//Test the new password
/usr/local/MySQL (The best combination with PHP)/bin/MySQL (The best combination with PHP) –u root –p MySQL (The best combination with PHP)
enter password: //If everything goes well, you can enter MySQL (the best combination with PHP).
//apache (the most popular WEB server platform on Unix platform) installation process
./configure --prefix=/usr/local/apache (the most popular WEB server platform on Unix platform) --enable-mods=shared=all --enable-module=so --disable-info
make
make install
During the installation process of apache (the most popular WEB server platform on Unix platform), the problem of libiconv.so.2 was encountered. The solution is as follows:
ln –sf /usr/local/lib/libiconv.so.2 /usr/lib/libiconv.so.2
//Type the local IP in the window bar. If the famous Feather web page appears, it will be considered successful...
//php (as the current mainstream development language) installation process
./configure --prefix=/usr/local/php (as the current mainstream development language) --with-MySQL (the best combination with PHP) =/usr/local/MySQL (the best combination with PHP) combination) --with-apxs2=/usr/local/apache (the most popular WEB server platform on Unix platform)/bin/apxs --enable-calendar --with-openssl=/usr/ --with-config-file- path=/usr/local/php (as the current mainstream development language)
make
make install
cp /usr/local/src/php (as the current mainstream development language)-5.1.2/php (as the current mainstream development language).ini-dist /usr/local/lib/php (as the current mainstream development language) Mainstream development languages).ini
#cd usr/local/apache (the most popular WEB server platform on Unix platform)/conf
//Then open httpd.conf and modify it in the corresponding place
AddType application/x-httpd-php (as the current mainstream development language) .php (as the current mainstream development language)
AddType application/x-httpd-php (as the current mainstream development language)-source .php (as the current mainstream development language) s
DocumentRoot "/usr/local/apache (the most popular WEB server platform on Unix platform)/htdocs"
LoadModule php (as the current mainstream development language) 5_module modules/libphp (as the current mainstream development language) 5.so
//Put the tested .php (as the current mainstream development language) file into /usr/local/apache (the most popular WEB server platform on Unix platform)/htdocs/. If the page can be opened in the window bar, you are done.
//FAQ 1: ERROR 2002: Can't connect to local MySQL(The best combination with PHP) server through socket '/var/lib/MySQL(The best combination with PHP)/MySQL(The best combination with PHP) The best combination).sock
' (2)
//Solution: Permission problem
chown -R MySQL (The best combination with PHP) /var/lib/MySQL (The best combination with PHP)/
//FAQ 2: Warning: MySQL (the best combination with PHP) Connection Failed: Can't connect to local MySQL (the best combination with PHP) server
// through socket '/tmp/MySQL (the best combination with PHP).sock' (111) in /home/httpd/html/show.php (as the current mainstream development language) on line 9
//Solution: Link /tmp/MySQL (the best combination with PHP).sock link to the /var/lib/MySQL (the best combination with PHP) directory:
linux# ln -s /var/lib/MySQL(The best combination with PHP)/MySQL(The best combination with PHP).sock /tmp/MySQL(The best combination with PHP).sock