Compile and install Apache + MySQL + PHP in CentOS 5.5

Source: Internet
Author: User
Tags install openssl

# Check and uninstall
Rpm-qa | grep httpd
Rpm-e httpd
Rpm-qa | grep mysql
Rpm-e mysql
Rpm-qa | grep php
Rpm-e php

Yum-y remove httpd

# Find the fastest Source
Yum-y install yum-fastestmirror
Yum-y update
Yum-y install patch make gcc-c ++ gcc-g77 flex bison file
Yum-y install libtool-libs autoconf kernel-devel
Yum-y install libjpeg-devel libpng-devel libpng10 libpng10-devel gd-devel
Yum-y install freetype-devel libxml2 libxml2-devel zlib-devel
Yum-y install glib2 glib2-devel bzip2 bzip2-devel libevent-devel
Yum-y install ncurses-devel curl-devel e2fsprogs
Yum-y install e2fsprogs-devel krb5 krb5-devel libidn-devel
Yum-y install openssl-devel vim-minimal nano sendmail
Yum-y install fonts-chinese gettext-devel
Yum-y install ncurses-devel
Yum-y install gmp-devel pspell-devel
Yum-y install unzip

Http://soft.vpser.net/web/libmcrypt/libmcrypt-2.5.8.tar.gz wget-c
Tar zxvf libmcrypt-2.5.8.tar.gz
Cd libmcrypt-2.5.8/
./Configure
Make & make install
/Sbin/ldconfig
Cd libltdl/
./Configure -- enable-ltdl-install
Make & make install
Cd http://www.cnblogs.com/

Http://soft.vpser.net/web/mhash/mhash-0.9.9.9.tar.gz wget-c
Tar zxvf mhash-0.9.9.9.tar.gz
Cd mhash-0.9.9.9/
./Configure
Make & make install
Cd ../

Http://soft.vpser.net/web/libiconv/libiconv-1.13.tar.gz wget-c
Tar zxvf libiconv-1.13.tar.gz
Cd libiconv-1.13/
./Configure -- prefix =/usr/local
Make & make install
Cd ../

Ln-s/usr/local/lib/libmcrypt. la/usr/lib/libmcrypt. la
Ln-s/usr/local/lib/libmcrypt. so/usr/lib/libmcrypt. so
Ln-s/usr/local/lib/libmcrypt. so.4/usr/lib/libmcrypt. so.4
Ln-s/usr/local/lib/libmcrypt. so.4.4.8/usr/lib/libmcrypt. so.4.4.8
Ln-s/usr/local/lib/libmhash. a/usr/lib/libmhash.
Ln-s/usr/local/lib/libmhash. la/usr/lib/libmhash. la
Ln-s/usr/local/lib/libmhash. so/usr/lib/libmhash. so
Ln-s/usr/local/lib/libmhash. so.2/usr/lib/libmhash. so.2
Ln-s/usr/local/lib/libmhash. so.2.0.1/usr/lib/libmhash. so.2.0.1

Http://soft.vpser.net/web/mcrypt/mcrypt-2.6.8.tar.gz wget-c
Tar zxvf mcrypt-2.6.8.tar.gz
Cd mcrypt-2.6.8/
./Configure
Make & make install
Cd ../

# Install mysql
Http://soft.vpser.net/datebase/mysql/mysql-5.1.44.tar.gz wget-c
Http://soft.vpser.net/web/pdo/PDO_MYSQL-1.0.2.tgz wget-c
Tar-zxvf mysql-5.1.44.tar.gz
Cd mysql-5.1.44/
. /Configure -- prefix =/usr/local/mysql -- with-extra-charsets = all -- enable-thread-safe-client -- enable-character er -- with-charset = utf8 -- enable- thread-safe-client -- with-extra-charsets = all -- with-big-tables -- with-readline -- with-ssl -- with-embedded-server -- enable-local-infile
Make & make install
Cd ../

Groupadd mysql
Useradd-g mysql
Cp/usr/local/mysql/share/mysql/my-medium.cnf/etc/my. cnf
/Usr/local/mysql/bin/mysql_install_db -- user = mysql
Chown-R mysql/usr/local/mysql/var
Chgrp-R mysql/usr/local/mysql /.
Cp/usr/local/mysql/share/mysql. server/etc/init. d/mysql
Chmod 755/etc/init. d/mysql
Chkconfig -- level 345 mysql on
Echo "/usr/local/mysql/lib/mysql">/etc/ld. so. conf
Echo "/usr/local/lib">/etc/ld. so. conf

Ldconfig
Ln-s/usr/local/mysql/lib/mysql/usr/lib/mysql
Ln-s/usr/local/mysql/include/mysql/usr/include/mysql
/Etc/init. d/mysql start

/Usr/local/mysql/bin/mysqladmin-u root password $ mysqlrootpwd

/Etc/init. d/mysql restart
/Etc/init. d/mysql stop
Chkconfig mysql-ndb off
Chkconfig mysql-ndb-mgm off


# Install apache
Wget http://soft.vpser.net/web/apache/httpd-2.2.11.tar.gz
Tar zxvf httpd-2.2.11.tar.gz
Cd httpd-2.2.11
./Configure -- prefix =/usr/local/apache -- enable-deflate = shared -- enable-headers = shared -- enable-info = shared -- enable-rewrite = shared -- enable-so
Make
Make install
Cd ../


# Install php
Wget http://soft.vpser.net/web/php/php-5.2.10.tar.gz
Tar zxvf php-5.2.10.tar.gz
Cd php-5.2.10/
. /Configure -- prefix =/usr/local/php -- with-config-file-path =/usr/local/php/etc -- with-apxs2 =/usr/local/apache/bin/ apxs -- with-mysql =/usr/local/mysql -- with-mysqli =/usr/local/mysql/bin/mysql_config -- with-iconv-dir =/usr/local/libiconv -- with-freetype-dir -- with-jpeg-dir -- with-png-dir -- with-zlib -- with-libxml-dir =/usr -- enable-xml -- disable-rpath -- enable-discard-path -- enable-safe-mode -- enable-bcmath -- enable-shmop -- enable-sysvsem -- enable-inline-optimization -- with-curl -- with-curlwrappers -- enable-mode- mbregex -- enable-fastcgi -- enable-force-cgi-redirect -- enable-mbstring -- with-mcrypt -- with-gd -- enable-gd-native-ttf -- with-openssl --- mhash -- enable-pcntl -- enable-sockets -- with-xmlrpc -- enable-zip -- enable-soap -- without-pear
# If you do not need the following two lines, you can change this line # -- lcrypt -- liconv # make & make install
Make ZEND_EXTRA_LIBS = '-liconv'
Make install

Mkdir-p/usr/local/php/etc
Cp php. ini-dist/usr/local/php/etc/php. ini
Cd ../

# Php extensions
Sed-I's # output_buffering = Off # output_buffering = On # '/usr/local/php/etc/php. ini
Sed-I's/post_max_size = 8 M/post_max_size = 50 M/G'/usr/local/php/etc/php. ini
Sed-I's/upload_max_filesize = 2 M/upload_max_filesize = 50 M/G'/usr/local/php/etc/php. ini
Sed-I's/; date. timezone =/date. timezone = PRC/G'/usr/local/php/etc/php. ini

# Installing zend
Wget http://soft.vpser.net/web/zend/ZendOptimizer-3.3.9-linux-glibc23-i386.tar.gz
Tar zxvf ZendOptimizer-3.3.9-linux-glibc23-i386.tar.gz
Mkdir-p/usr/local/zend/
Cp ZendOptimizer-3.3.9-linux-glibc23-i386/data/5_2_x_comp/ZendOptimizer. so/usr/local/zend/

Cat>/usr/local/php/etc/php. ini <EOF
[Zend Optimizer]
Zend_optimizer.optimization_level = 1
Zend_extension = "/usr/local/zend/ZendOptimizer. so"
EOF

# Add a user and create a website root directory
Groupadd www
Useradd-g www
Mkdir-p/home/wwwroot
Chmod + w/home/wwwroot
Chown-R www: www/home/wwwroot

# Install phpmyadmin
Cd/home/wwwroot
Wget http://soft.vpser.net/datebase/phpmyadmin/phpmyadmin.tar.gz
Tar zxvf phpmyadmin.tar.gz
Cd ~


# Install the PHP acceleration cache plug-in eAccelerator
Wget http://soft.vpser.net/web/eaccelerator/eaccelerator-0.9.5.3.tar.bz2
Tar jxvf eaccelerator-0.9.5.3.tar.bz2
Cd eaccelerator-0.9.5.3/
/Usr/local/php/bin/phpize
./Configure -- enable-eaccelerator = shared -- with-php-config =/usr/local/php/bin/php-config
Make
Make install
Cd ../

Mkdir-p/usr/local/eaccelerator_cache
Cat>/usr/local/php/etc/php. ini <EOF
[Eaccelerator]
Zend_extension = "/usr/local/php/lib/php/extensions/no-debug-non-zts-20060613/eaccelerator. so"
Eaccelerator. shm_size = "16"
Eaccelerator. cache_dir = "/usr/local/eaccelerator_cache"
Eaccelerator. enable = "1"
Eaccelerator. optimizer = "1"
Eaccelerator. check_mtime = "1"
Eaccelerator. debug = "0"
Eaccelerator. filter = ""
Eaccelerator. shm_max = "0"
Eaccelerator. shm_ttl = "3600"
Eaccelerator. shm_prune_period = "3600"
Eaccelerator. shm_only = "0"
Eaccelerator. compress = "1"
Eaccelerator. compress_level = "9"
Eaccelerator. keys = "disk_only"
Eaccelerator. sessions = "disk_only"
Eaccelerator. content = "disk_only"
EOF

####################

# Start apache
/Usr/local/apache/bin/apachectl-k start

# Restart apache
#/Usr/local/apache/bin/apachectl-k restart
# Start ssl
#/Usr/local/apache/bin/apachectl-k startssl

# Start mysql
/Etc/init. d/mysql start


# Start startup
Vi/etc/rc. local
# Then
Ulimit-SHn 51200
/Etc/init. d/mysql start
/Usr/local/apache/bin/apachectl-k start


# Check Configuration
#/Usr/local/apache/bin/apachectl configtest

# Apache runtime module Detection
#/Usr/local/apache/bin/httpd-l

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.