wget http://www.php.net/get/php-5.3.23.tar.bz2/from/cn2.php.net/mirror mv mirror php-5.3.23.tar.bz2 tar jxvf php-5.3.23.tar.bz2 wget http://archive.apache.org/dist/httpd/httpd-2.4.4.tar.gz wget http://cdn.mysql.com/Downloads/MySQL-5.6/mysql-5.6.10.tar.gz wget http://mirror.bjtu.edu.cn/apache/apr/apr-1.4.6.tar.gz wget http://mirror.bjtu.edu.cn/apache/apr/apr-util-1.5.1.tar.gz wget http://sourceforge.net/projects/pcre/files/pcre/8.32/pcre-8.32.tar.gz/download wget http://zlib.net/zlib-1.2.8.tar.gz wget ftp://mcrypt.hellug.gr/pub/crypto/mcrypt/libmcrypt/libmcrypt-2.5.7.tar.gz apt-get install bison libxml2 libxml2-dev built-essential gcc openssl libssl-dev mcrypt libmcrypt-dev libgd2-xpm libgd2-xpm-dev sudo apt-get install libncurses5-dev #step one ,install apache tar zxvf apr-1.4.6.tar.gz cd apr-1.4.6/ ./configure --prefix=/usr/local/apr make && make install tar zxvf apr-util-1.5.1.tar.gz cd apr-util-1.5.1/ ./configure --prefix=/usr/local/apr-util \ --with-apr=/usr/local/apr/ make && make install cd pcre-8.32 ./configure && make && make install cd httpd-2.4.4 ./configure --prefix=/usr/local/httpd --enable-so --enable-mods-shared=all \ --enable-deflate --enable-cache --enable-file-cache --enable-mem-cache \ --enable-disk-cache --with-apr=/usr/local/apr/ \ --with-apr-util=/usr/local/apr-util/ --enable-rewrite --enable-expires \ --enable-authn-dbm --enable-vhost-alias --with-mpm=worker --with-ssl \ --disable-ipv6 --disable-cgid --disable-cgi #step two, install php wget http://www.ijg.org/files/jpegsrc.v6b.tar.gz wget http://download.sourceforge.net/libpng/libpng-1.6.2.tar.gz wget http://download.savannah.gnu.org/releases/freetype/freetype-2.4.11.tar.gz tar zxvf jpegsrc.v6b.tar.gz ./configure --enable-shared --enable-static &&make&&make install tar jxvf libpng-1.2.10.tar.bz2 ./configure &&make&&make install tar jxvf freetype-2.3.9.tar.bz2 ./configure && make && make install ./configure --with-apxs2=/usr/local/httpd/bin/apxs \ --prefix=/usr/local/php \ --with-config-file-path=/usr/local/php/etc \ --enable-mysqlnd --with-mysql=mysqlnd \ --with-mysqli=mysqlnd --enable-pdo --enable-ftp \ --with-pdo-mysql=mysqlnd --with-iconv-dir=/usr/local --with-freetype-dir \ --with-jpeg-dir --with-png-dir --with-zlib --with-libxml-dir=/usr --enable-xml \ --disable-rpath --enable-bcmath --enable-shmop \ --enable-inline-optimization --with-curl --with-curlwrappers --enable-mbregex \ --enable-mbstring --with-mcrypt --with-gd --enable-gd-native-ttf --with-openssl \ --with-mhash --enable-pcntl --enable-sockets --with-ldap-sasl \ --with-xmlrpc --enable-zip --enable-soap --with-pear --with-zlib --enable-fpm --enable-pdo --enable-sockets --enable-exif --enable-soap --enable-ftp --enable-wddx --enable-soap --enable-mbstring --enable-dba --enable-gd-native-ttf --enable-calendar --enable-sysvmsg --enable-sysvsem --enable-sysvshm --with-iconv --with-zlib --with-bz2 --with-gettext --with-xmlrpc --with-openssl --with-mcrypt --with-xsl --with-pcre-regex --with-freetype-dir=/usr --with-jpeg-dir=/usr --with-png-dir=/usr --with-ldap make && make install #add to httpd.conf <FilesMatch \.php$> SetHandler application/x-httpd-php </FilesMatch> # install nginx ./configure --prefix=/usr/local/nginx \ --with-rtsig_module \ --with-poll_module \ --with-ipv6 \ --with-http_ssl_module \ --with-http_realip_module \ --with-http_addition_module \ --with-http_xslt_module \ --with-http_image_filter_module \ --with-http_sub_module \ --with-http_flv_module \ --with-http_gzip_static_module \ --with-http_random_index_module \ --with-http_secure_link_module \ --with-http_degradation_module \ --with-http_stub_status_module \ --with-pcre ##install php php-fpm ./configure --prefix=/usr/local/php54 --with-config-file-path=/usr/local/php54/etc \ --enable-mysqlnd --with-mysql=mysqlnd --with-mysqli=mysqlnd --enable-fpm \ --with-pdo-mysql=mysqlnd --with-iconv-dir=/usr/local --with-freetype-dir \ --with-jpeg-dir --with-png-dir --with-zlib --with-libxml-dir=/usr --enable-xml \ --disable-rpath --enable-bcmath --enable-inline-optimization \ --with-curl --with-curlwrappers --enable-mbregex --enable-mbstring --with-mcrypt \ --with-gd --enable-gd-native-ttf --with-mhash --enable-pcntl --enable-sockets \ --with-ldap-sasl --with-xmlrpc --enable-zip --enable-soap --with-pear --with-zlib --enable-fpm --enable-pdo --enable-sockets --enable-exif --enable-soap --enable-ftp --enable-wddx --enable-pcntl --enable-soap --enable-dba --enable-gd-native-ttf --enable-zip --enable-calendar --enable-shmop --enable-sysvmsg --enable-sysvsem --enable-sysvshm --with-iconv --with-zlib --with-bz2 --with-gettext --with-xmlrpc --with-openssl --with-mcrypt --with-xsl --with-pcre-regex --with-freetype-dir=/usr --with-jpeg-dir=/usr --with-png-dir=/usr --with-ldap --with-apxs2=/png/httpd/2.4.10/bin/apxs http://cdn.mysql.com/Downloads/MySQL-5.6/mysql-5.6.13.tar.gz #setp three,install mysql cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql \ -DSYSCONFDIR=/etc \ -DMYSQL_UNIX_ADDR=/tmp/mysqld.sock \ -DMYSQL_DATADIR=/data1/mysql_db -DEXTRA_CHARSETS=all \ -DDEFAULT_CHARSET=utf8 -DWITH_READLINE=ON -DWITH_SSL=system \ -DWITH_DEBUG=0 \ -DWITH_PARTITION_STORAGE_ENGINE=1 \ -DWITH_INNOBASE_STORAGE_ENGINE=1 \ -DWITH_ARCHIVE_STORAGE_ENGINE=1 \ -DWITH_FEDERATED_STORAGE_ENGINE=1 \ -DWITH_BLACKHOLE_STORAGE_ENGINE=1 \ -DINSTALL_LAYOUT=STANDALONE -DENABLED_LOCAL_INFILE=1 \ -DENABLED_PROFILING=1 -DMYSQL_MAINTAINER_MODE=0 \ -DWITH_EMBEDDED_SERVER=1 -DMYSQL_TCP_PORT=3306 \ -DMYSQL_USER=mysql make && make install #add [mysqld] character-set-server = utf8 #出现的错误 #COLLATION 'latin1_swedish_ci' is not valid for CHARACTER SET 'utf8' #解决办法: # ./scripts/mysql_install_db --user=mysql --collation-server=utf8_general_ci # configure: error: Cannot find OpenSSL’s <evp.h> or <hmac.h> in this case, the compiler wants to tell you that you haven’t the openSSL developer library installed. Do so by: sudo apt-get install openssl-dev on some systems, like Ubuntu Feisty, you might need to use this command: sudo apt-get install libcurl4-openssl-dev mysql5.1.x系列 ./configure \ --prefix=/usr/local/mysql --sysconfdir=/usr/local/mysql \ --localstatedir=/data/mysql/data/ \ mysql数据目录 --without-debug --enable-assembler \ --with-mysqld-ldflags=-all-static \ --with-client-ldflags=-all-static \ --with-unix-socket-path=/tmp/mysql.sock \ --with-mysqld-user=mysql \ --with-extra-charsets=utf8,gbk,gb2312 \ --with-innodb \ --with-mysqld-user=mysql \ --with-charset=utf8 --with-collation=utf8_unicode_ci --------------------------------------------------------- 如果需要支持表分区, 需要添加 --with-partition ./configure --enable-fpm --prefix=/usr/local/php54 \ --with-config-file-path=/usr/local/php54/etc \ --enable-mysqlnd --with-mysql=mysqlnd \ --with-mysqli=mysqlnd \ --with-pdo-mysql=mysqlnd --with-iconv-dir=/usr/local --with-freetype-dir \ --with-jpeg-dir --with-png-dir --with-zlib --with-libxml-dir=/usr --enable-xml \ --disable-rpath --enable-bcmath --enable-shmop --enable-sysvsem \ --enable-inline-optimization --with-curl --enable-mbregex \ --enable-mbstring --with-mcrypt --with-gd --enable-gd-native-ttf --with-openssl \ --with-mhash --enable-pcntl --enable-sockets --with-ldap-sasl \ --with-xmlrpc --enable-zip --with-pear --with-zlib make ZEND_EXTRA_LIBS='-liconv' 修改/etc/profile文件使其永久性生效,并对所有系统用户生效,在文件末尾加上如下两行代码 PATH=$PATH:/usr/local/webserver/php/bin:/usr/local/webserver/mysql/bin export PATH