The following articles mainly describe the installation notes for Mysql + php5 + apache under the linux operating system. I saw the installation notes for Mysql + php5 + apache on the relevant website two days ago, I think it is good, so I will share it with you.
According to the official recommendation, httpd-2.2.3.tar.gz,
Install apache2
- #./configure –prefix=/usr/local/apache2 –enable-module=alias –enable-module=most \
- –enable-module=vhost_alias –enable-shared=vhost_alias –enable-module=so –enable-shared=max
- # make;make install
Download the latest stable version: mysql-standard-5.0.27-linux-i686-glibc23.tar.gz
No installation required. Unzip the package and move it to/usr/local/mysql.
# Groupadd mysql # create a mysql Group
# Useradd mysql-g mysql # create a mysql user and add it to the mysql Group
# Cd/usr/local/mysql
Then set permissions
- # Chown-R root. # Set root to access/usr/local/mysql
- # Chown-R mysql data # Set mysql users to access/usr/local/mysql/data, which contains mysql database files
- # Chown-R mysql data/. # Set mysql users to access all files under/usr/local/mysql/data
- # Chown-R mysql data/mysql/. # Set mysql users to access all files in/usr/local/mysql/data/mysql
- # Chgrp-R mysql. # Set the mysql group to access/usr/local/mysql
Run mysql:
- # /usr/local/mysql/bin/mysqld_safe –user=mysql &
Change the root password. The default value is null:
- /usr/local/mysql/bin/mysqladmin -u root password ‘newpassword’
MYSQL + php5 + apache installation complete
Download the latest stable version: php-5.1.6.tar.gz,
1. Install zlib (zlib must be installed before libpng and gd are installed ),
- # tar zxvf zlib-1.2.3.tar.gz
- # cd zlib-1.2.3
- # ./configure
- # make;make install
2. Install libpng,
- # tar zxvf libpng-1.2.12.tar.gz
- # cd libpng-1.2.12
- # ./configure
- # make;make install
3. Install freetype,
- # tar zxvf freetype-2.2.1.tar.gz
- # cd freetype-2.1.10
- # ./configure –prefix=/usr/local/freetype
- # make;make install
4. Install jpeg,
- # tar zxvf jpegsrc.v6b.tar.gz
- # cd jpeg-6b
- # mkdir /usr/local/jpeg
- # mkdir /usr/local/jpeg/bin
- # mkdir /usr/local/jpeg/lib
- # mkdir /usr/local/jpeg/include
- # mkdir /usr/local/jpeg/man
- # mkdir /usr/local/jpeg/man/man1
- # ./configure –prefix=/usr/local/jpeg –enable-shared –enable-static
- # make;make install
5. Install gd,
- # tar zxvf gd-2.0.33.tar.gz
- # cd gd-2.0.33
- # ./configure –prefix=/usr/local/gd –with-jpeg=/usr/local/jpeg –with-freetype=/usr/local/freetype –with-png –with-zlib
The following information is displayed during Mysql + php5 + apache compilation.
** Configuration summary for gd 2.0.33:
- Support for PNG library: yes
- Support for JPEG library: yes
- Support for Freetype 2.x library: yes
- Support for Fontconfig library: no
- Support for Xpm library: no
- Support for pthreads: yes
We can see that png, jpeg, and freetype have been installed.
- # make
- # make install
6. Officially install php
- # tar zxvf php-5.1.6.tar.gz
- # cd php-5.1.6
- # ./configure –prefix=/usr/local/php5 –with-apxs2=/usr/local/apache2/bin/apxs –with-mysql=
/usr/local/mysql –with-gd –with-zlib –with-png –with-jpeg –with-freetype
–enable-sockets –with-iconv –enable-mbstring –enable-track-vars –enable-force-cgi-redirect –with-config-file-path=/usr/local/php5/etc
7. Integrate php and apache
- cp php.ini-dist /usr/local/php5/etc/php.ini
- vi /usr/local/php5/etc/php.ini
Remove the # Above extension = php_mysql.dll
8. Install ZendOptimizer,
- # tar zxvf ZendOptimizer-3.0.1-linux-glibc21-i386.tar.gz
- # cd ZendOptimizer-3.0.1-linux-glibc21-i386
- # ./install.sh
Installation: [OK]-> [EXIT]-> [YES]-> [/httpd/zend]-> [/httpd/apache/conf]-> [yes]-> [OK ]-> [OK]-> [NO]
Solve the following errors:
1. php5 prompts: configure: error: mysql configure failed ., if you only use the-with-mysql parameter prompt: Cannot find MySQL header files under yes, remove the-with-mysql parameter and install it. php5 Cannot connect to mysql + php5 + apache. The prompt on the page is: fatal error: Call to undefined function mysql_connect ().
I checked it and found that the version corresponding to mysql5 is incorrect. Just change the version.
It will be normal after renewal.
2. An error occurs when mysql is restarted. The prompt is:
- Starting mysqld daemon with databases from /usr/local/mysql/data
- STOPPING server from pid file /usr/local/mysql/data/xmcncn.pid
- 061103 15:25:32 mysqld ended
Ask the expert gump for the solution:
- touch /tmp/mysql.sock
- killall -9 mysqld
- /usr/local/mysql/bin/mysqld_safe -user=mysql &
Started successfully
PS: I am a newbie. I have been searching for all these software for a whole day, especially a few small software programs that are hard to find. Now all of them are listed. Many problems were encountered during testing and installation, and some problems were solved with the help of Comrade gump. I have posted several installation articles on the website, some of which are older and not comprehensive, so I wrote this installation process, it will be easy to install later :) I hope it will be helpful for some new users.