Upgrade and installation of apache + php + mysql in linux

Source: Internet
Author: User
Article Title: Upgrade and installation of apache, php, and mysql in linux. Linux is a technology channel of the IT lab in China. Includes basic categories such as desktop applications, Linux system management, kernel research, embedded systems, and open source.

Because the linux version of the server is too low, the apache + php + mysql version is too low. After three days of study for linux, I finally upgraded apache + php + mysql! The upgrade process is as follows:

1. Delete apache + php + mysql:

Determine if rpm is installed. For example, if rpm-q php returns the php version, it is rpm installation. You can use rpm-e php -- nodeps to completely delete the php version that comes with the system.

If the PHP version is not returned, the installation is binary. You can directly Delete the directory! The same is true for apache mysql!

2. install apache

Download httpd-2.2.4.tar.gz

Tar xzvf httpd-2.2.4.tar.gz
Cd httpd-2.2.4
. /Configure -- prefix =/usr/local/apache2 -- enable-so -- enable-mod-shared = all -- enable-cgi -- enable-rewrite -- enable-deflate -- with-mpm = worker
Make
Make install

3. Install mysql

# Chmod 755 mysql-5.0.45-linux-i686-glibc23.tar.gz // set mysql-5.0.45-linux-i686-glibc23.tar.gz attribute to 755
# Tar xzvf mysql-5.0.45-linux-i686-glibc23.tar.gz // unzip
# Cp-r mysql-5.0.45-linux-i686-glibc23/usr/local //
# Music mysql-5.0.45-linux-i686-glibc23 mysql //
# Cd mysql //
# Groupadd mysql // create a mysql Group
# Useradd mysql-g mysql // create a mysql user and add it to the mysql Group
# Cp/usr/local/mysql/support-files/my-medium.cnf/etc/my. cnf
There are four template files in the support-files directory. We select one of the Mysql configuration files to overwrite/etc/my. cnf (default system configuration, with performance parameters and some path parameters of Mysql)
# Run cd/usr/local/mysql to enter the mysql directory.
#./Scripts/mysql_install_db -- user = mysql // The first trial table and requires mysql users to access the table. After the table is initialized, set the access permissions for mysql and root users.
# Chown-R root // set root to access/usr/local/mysql
# Chown-R mysql data // sets mysql users to access mysql database files stored in/usr/local/mysql/data. this directory is in/etc/my. cnf is configured and generated in mysql_install_db.
# Chown-R mysql data // set that mysql users can access all files in/usr/local/mysql/data/mysql
# Chgrp-R mysql // set the mysql group to access/usr/local/mysql
#/Usr/local/mysql/bin/mysqld_safe -- user = mysql & run mysql. If there is no problem, a prompt similar to this will appear:
[1] 42264
# Starting mysqld daemon with databases from/usr/local/mysql/var
If a statement such as mysql ended is displayed, it indicates that Mysql is not started normally. You can find the problem in log. The Log file is usually configured in/etc/my. cnf. Most problems are caused by incorrect permission settings.
#/Usr/local/mysql/bin/mysqladmin-u root password yourpassword // The default installation password is blank. You must change it immediately for security purposes.
# Cp support-files/mysql. server/etc/rc. d/init. d/mysqld settings enable mysql to run automatically at each startup
# Chmod 700/etc/init. d/mysqld
# Chkconfig -- add mysqld
# Chkconfig -- level 345 mysqld on
# Service mysqld start // start the mysqld service
# Netstat-atln // check whether the port 3306 is enabled. Make sure that the port is opened in the firewall.

4. install php

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 restart src.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.35.tar.gz
# Cd gd-2.0.35
#. /Configure -- prefix =/usr/local/gd -- with-jpeg =/usr/local/jpeg -- with-freetype =/usr/local/freetype -- with-png --- zlib
// The following information is displayed during 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
// You can see that png, jpeg, and freetype have been installed.
# Make
# Make install

6. Officially install php
# Tar zxvf php-5.2.3.tar.gz
# Cd php-5.2.3
#. /Configure -- prefix =/usr/local/php5 -- with-apxs2 =/usr/local/apache2/bin/apxs -- with-mysql =/usr/local/mysql -- with-gd = /usr/local/gd -- with-zlib -- with-libpng -- with-jpeg =/usr/local/jpeg -- with-freetype =/usr/local/freetype -- enable-sockets -- with-iconv -- enable-mbstring -- enable-track-vars -- enable-force-cgi-redirect -- with-config-file-path =/usr/local/php5/etc
# Make
# Make install

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
Note that the code added to/usr/local/apache2/conf/httpd. conf enables apache to execute PHP

AddType application/x-httpd-php. php
AddType application/x-httpd-php3. php3
AddType applications/x-httpd-php4. php4
AddType application/x-httpd-php-source. phps

8. Install ZendOptimizer
# Tar zxvf ZendOptimizer-3.0.1-linux-glibc21-i386.tar.gz
# Cd ZendOptimizer-3.0.1-linux-glibc21-i386
#./Install. sh

Appendix: software:

Apache 2.26 http://apache.mirror.phpchina.com/httpd/httpd-2.2.6.tar.gz
Mysql 5.0.22: download.mysql.cn/src/2006/0710/5544.html
Php 5.25: http://cn.php.net/get/php-5.2.5.tar.gz/from/this/mirror
Zlib 1.2.3: http://www.zlib.net/zlib-1.2.3.tar.gz

Libpng 1.2.23: http://jaist.dl.sourceforge.net/sourceforge/libpng/libpng-1.2.23.tar.gz

Freetype 2.3.5: http://nchc.dl.sourceforge.net/sourceforge/freetype/freetype-2.3.5.tar.gz

Jpeg: http://www.ijg.org/files/jpegsrc.v6b.tar.gz
Gd2.0.35: http://www.libgd.org/releases/gd-2.0.35.tar.gz

 

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.