Installation notes for MySQL + PHP5 + Apache (Linux Version)

Source: Internet
Author: User

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

 
 
  1. #./configure –prefix=/usr/local/apache2 –enable-module=alias –enable-module=most \  
  2. –enable-module=vhost_alias –enable-shared=vhost_alias –enable-module=so –enable-shared=max 
  3. # 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

 
 
  1. # Chown-R root. # Set root to access/usr/local/mysql
  2. # Chown-R mysql data # Set mysql users to access/usr/local/mysql/data, which contains mysql database files
  3. # Chown-R mysql data/. # Set mysql users to access all files under/usr/local/mysql/data
  4. # Chown-R mysql data/mysql/. # Set mysql users to access all files in/usr/local/mysql/data/mysql
  5. # Chgrp-R mysql. # Set the mysql group to access/usr/local/mysql

Run mysql:

 
 
  1. # /usr/local/mysql/bin/mysqld_safe –user=mysql & 

Change the root password. The default value is null:

 
 
  1. /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 ),

 
 
  1. # tar zxvf zlib-1.2.3.tar.gz  
  2. # cd zlib-1.2.3  
  3. # ./configure  
  4. # make;make install 

2. Install libpng,

 
 
  1. # tar zxvf libpng-1.2.12.tar.gz  
  2. # cd libpng-1.2.12  
  3. # ./configure  
  4. # make;make install 

3. Install freetype,

 
 
  1. # tar zxvf freetype-2.2.1.tar.gz  
  2. # cd freetype-2.1.10  
  3. # ./configure –prefix=/usr/local/freetype  
  4. # make;make install 

4. Install jpeg,

 
 
  1. # tar zxvf jpegsrc.v6b.tar.gz  
  2. # cd jpeg-6b  
  3. # mkdir /usr/local/jpeg  
  4. # mkdir /usr/local/jpeg/bin  
  5. # mkdir /usr/local/jpeg/lib  
  6. # mkdir /usr/local/jpeg/include  
  7. # mkdir /usr/local/jpeg/man  
  8. # mkdir /usr/local/jpeg/man/man1  
  9. # ./configure –prefix=/usr/local/jpeg –enable-shared –enable-static  
  10. # make;make install 

5. Install gd,

 
 
  1. # tar zxvf gd-2.0.33.tar.gz  
  2. # cd gd-2.0.33  
  3. # ./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:

 
 
  1. Support for PNG library: yes  
  2. Support for JPEG library: yes  
  3. Support for Freetype 2.x library: yes  
  4. Support for Fontconfig library: no  
  5. Support for Xpm library: no  
  6. Support for pthreads: yes 

We can see that png, jpeg, and freetype have been installed.

 
 
  1. # make  
  2. # make install  

6. Officially install php

 
 
  1. # tar zxvf php-5.1.6.tar.gz  
  2. # cd php-5.1.6  
  3. # ./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

 
 
  1. cp php.ini-dist /usr/local/php5/etc/php.ini  
  2. vi /usr/local/php5/etc/php.ini 

Remove the # Above extension = php_mysql.dll

8. Install ZendOptimizer,

 
 
  1. # tar zxvf ZendOptimizer-3.0.1-linux-glibc21-i386.tar.gz  
  2. # cd ZendOptimizer-3.0.1-linux-glibc21-i386  
  3. # ./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:

 
 
  1. Starting mysqld daemon with databases from /usr/local/mysql/data  
  2. STOPPING server from pid file /usr/local/mysql/data/xmcncn.pid  
  3. 061103 15:25:32 mysqld ended 

Ask the expert gump for the solution:

 
 
  1. touch /tmp/mysql.sock  
  2. killall -9 mysqld  
  3. /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.


 

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.