LAMP安装手记(CentOS6.4+Apache-2.2.22+Mysql-5.1.63+PHP-5.2.17+phpmyadmin-3.4.10.2+ZendDebug)

LAMP安装手记(CentOS6.4+Apache-2.2.22+Mysql-5.1.63+PHP-5.2.17+phpmyadmin-3.4.10.2+ZendDebug)

rpm -e httpd

rpm -e mysql

rpm -e php

yum -y remove httpd php mysql-server mysql php-mysql 

setenforce 0

yum -y install gcc gcc-c++  make automake autoconf kernel-devel ncurses-devel libxml2-devel openssl-devel curl-devel libjpeg-devel libpng-devel  pcre-devel libtool-libs freetype-devel gd zlib-devel file bison patch mlocate flex diffutils   readline-devel glibc-devel glib2-devel bzip2-devel gettext-devel libcap-devel libmcrypt-devel wget unzip 

wget -c http://archive.apache.org/dist/httpd/httpd-2.2.22.tar.gz

wget -c http://dl.mysql.cn/mysql5/5.1/mysql-5.1.63.tar.gz

wget -c http://iweb.dl.sourceforge.net/project/phpmyadmin/phpMyAdmin/3.4.10.2/phpMyAdmin-3.4.10.2-all-languages.tar.gz

wget -c http://us2.php.net/get/php-5.2.17.tar.gz/from/am.php.net/mirror

tar xzf httpd-2.2.22.tar.gz

tar xzf mysql-5.1.63.tar.gz

tar xzf php-5.2.17.tar.gz

tar xzf phpMyAdmin-3.4.10.2-all-languages.tar.gz

cd /tmp/httpd-2.2.22

./configure --prefix=/usr/local/apache --with-included-apr --enable-so --enable-deflate=shared --enable-expires=shared  --enable-headers=shared --enable-rewrite=shared --enable-static-support

make

make install

cp build/rpm/httpd.init /etc/init.d/httpd //使用init脚本管理httpd

chmod 755 /etc/init.d/httpd //增加执行权限

chkconfig --add httpd  //添加httpd到服务项

chkconfig  httpd on   //设置开机启动

ln -fs /usr/local/apache/ /etc/httpd

ln -fs /usr/local/apache/bin/httpd /usr/sbin/httpd

ln -fs /usr/local/apache/bin/apachectl /usr/sbin/apachectl

ln -fs /usr/local/apache/logs /var/log/httpd //设置软链接以适应init脚本

groupadd mysql

useradd -g mysql mysql

cd /tmp/mysql-5.1.63

./configure --prefix=/usr/local/mysql/ --localstatedir=/usr/local/mysql/data --without-debug --with-unix-socket-path=/tmp/mysql.sock --with-client-ldflags=-all-static --with-mysqld-ldflags=-all-static --enable-assembler --with-extra-charsets=gbk,gb2312,utf8 --with-pthread

make

make install

cp support-files/my-medium.cnf /etc/my.cnf //复制配置文件夹my.cnf

/usr/local/mysql/bin/mysql_install_db --user=mysql  //初始化数据库

chown -R root.mysql /usr/local/mysql

chown -R mysql /usr/local/mysql/data 

cp /tmp/mysql-5.1.63/support-files/mysql.server /etc/rc.d/init.d/mysqld  //init启动脚本

chown root.root /etc/rc.d/init.d/mysqld 

chmod 755 /etc/rc.d/init.d/mysqld

chkconfig --add mysqld

chkconfig  mysqld on

ln -s /usr/local/mysql/bin/mysql /usr/bin

ln -s /usr/local/mysql/bin/mysqladmin /usr/bin

service mysqld start

/usr/local/mysql/bin/mysqladmin -u root password '新密码'   //设置root密码

安装PHP

cd /tmp

wget http://superb-dca2.dl.sourceforge.net/project/mcrypt/Libmcrypt/2.5.8/libmcrypt-2.5.8.tar.gz

wget http://superb-dca2.dl.sourceforge.net/project/mhash/mhash/0.9.9.9/mhash-0.9.9.9.tar.gz

wget http://superb-sea2.dl.sourceforge.net/project/mcrypt/MCrypt/2.6.8/mcrypt-2.6.8.tar.gz

tar xzf libmcrypt-2.5.8.tar.gz

tar xzf mhash-0.9.9.9.tar.gz

tar xzf mcrypt-2.6.8.tar.gz

//安装libmcrypt

cd /tmp/libmcrypt-2.5.8

./configure --prefix=/usr

make && make install

//安装libmcrypt

cd /tmp/mhash-0.9.9.9

./configure --prefix=/usr

make && make install

//安装mcrypt

/sbin/ldconfig //搜索出可共享的动态链接库

cd /tmp/mcrypt-2.6.8

./configure

make && make install

解决可能出现的报错:

If configure fails try --with-jpeg-dir=<DIR>

configure: error: libpng.(a|so) not found.

解决:

yum install libpng libpng-devel

ln -s /usr/lib64/libjpeg.so /usr/lib/

ln -s /usr/lib64/libpng.so /usr/lib/

解决可能出现的libiconv报错

cd /tmp

wget http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.14.tar.gz

tar xzf libiconv-1.14.tar.gz

cd libiconv-1.14

./configure --prefix=/usr/local/libiconv

make && make install

cd /tmp/php-5.2.17

./configure --prefix=/usr/local/php --with-apxs2=/usr/local/apache/bin/apxs --with-config-file-path=/etc --with-config-file-scan-dir=/etc/php.d --with-openssl --with-zlib --enable-bcmath --with-bz2 --with-curl --enable-ftp --with-gd --enable-gd-native-ttf --with-gettext --with-mhash --enable-mbstring --with-mcrypt --enable-soap --enable-zip --with-iconv=/usr/local/libiconv --with-mysql=/usr/local/mysql --without-pear

make

make install

cp php.ini-dist /usr/local/php/etc/php.ini //复制配置文件php.ini

修改apache配置文件:

在/etc/httpd/conf/httpd.conf文件中加入php文件类型解析:

vi /etc/httpd/conf/httpd.conf

添加

AddType application/x-httpd-php .php .phtml .inc

AddType application/x-httpd-php-source .phps

找到:

ServerName www.example.com:80

修改为:

ServerName localhost:80

service httpd restart &nbsp;//重启httpd

安装ZendOptimizer-3.3.9

64位:http://downloads.zend.com/optimizer/3.3.9/ZendOptimizer-3.3.9-linux-glibc23-x86_64.tar.gz

32位:http://downloads.zend.com/optimizer/3.3.9/ZendOptimizer-3.3.9-linux-glibc23-i386.tar.gz

cd /tmp

wget&nbsp; http://downloads.zend.com/optimizer/3.3.9/ZendOptimizer-3.3.9-linux-glibc23-x86_64.tar.gz

tar xzf ZendOptimizer-3.3.9-linux-glibc23-i386.tar.gz

cd /tmp/ZendOptimizer-3.3.9-linux-glibc23-i386/data/5_2_x_comp/

mkdir -p /usr/local/Zend/lib/

cp ZendOptimizer.so /usr/local/Zend/lib

加载zendoptimizer,建立/etc/php.d/zend.ini文件,加入如下代码加载:

[zend]

zend_optimizer.optimization_level=15

zend_extension=/usr/local/Zend/lib/ZendOptimizer.so

service httpd restart

安装eAccelerator-0.9.6.1

cd /tmp

wget http://jaist.dl.sourceforge.net/project/eaccelerator/eaccelerator/eAccelerator%200.9.6.1/eaccelerator-0.9.6.1.zip

unzip eaccelerator-0.9.6.1.zip

cd eaccelerator-0.9.6.1

export PHP_PREFIX="/usr/local/php"

$PHP_PREFIX/bin/phpize

./configure -enable-eaccelerator=shared -with-php-config=$PHP_PREFIX/bin/php-config

make && make install

cd /tmp

mkdir eaccelerator

chmod 0777 eaccelerator

php zenddebugger 加载失败

用php -v 查看信息

[root@E modules]# php -v

Failed loading /usr/lib64/php/modules/ZendDebugger.so: libssl.so.0.9.8: cannot open shared object file: No such file or directory

Failed loading /usr/local/Zend/lib/ZendOptimizer.so: /usr/local/Zend/lib/ZendOptimizer.so: undefined symbol: zend_throw_exception_internal

Failed loading /usr/lib64/php/modules/ZendDebugger.so: libssl.so.0.9.8: cannot open shared object file: No such file or directory

Warning: Directive 'register_long_arrays' is deprecated in PHP 5.3 and greater in Unknown on line 0

Warning: Directive 'magic_quotes_gpc' is deprecated in PHP 5.3 and greater in Unknown on line 0

PHP 5.3.3 (cli) (built: Nov 22 2013 10:59:29)

Copyright (c) 1997-2010 The PHP Group

Zend Engine v2.3.0, Copyright (c) 1998-2010 Zend Technologies

原因:因为最新的linux发行版本&nbsp;libssl&nbsp;和&nbsp;libcrypto&nbsp;已升级到1.0.0

解决:只要创建相应的软链接即可

[root@E modules]# ll /usr/lib64/libssl*

-rwxr-xr-x. 1 root root 221568 2鏈? 23 2013 /usr/lib64/libssl3.so

lrwxrwxrwx. 1 root root 16 11鏈?26 19:31 /usr/lib64/libssl.so -> libssl.so.1.0.1e

lrwxrwxrwx. 1 root root 16 11鏈?26 19:31 /usr/lib64/libssl.so.10 -> libssl.so.1.0.1e

-rwxr-xr-x. 1 root root 436984 12鏈? 4 2013 /usr/lib64/libssl.so.1.0.1e

建立软连接:

ln -s /usr/lib64/libssl.so.1.0.1e /usr/lib64/libssl.so.0.9.8

[root@E modules]# ll /usr/lib64/libcrypto*

lrwxrwxrwx. 1 root root 19 11鏈?26 19:31 /usr/lib64/libcrypto.so -> libcrypto.so.1.0.1e

lrwxrwxrwx. 1 root root 19 11鏈?26 19:31 /usr/lib64/libcrypto.so.10 -> libcrypto.so.1.0.1e

-rwxr-xr-x. 1 root root 1946880 12鏈? 4 2013 /usr/lib64/libcrypto.so.1.0.1e

建立软连接:

ln -s /usr/lib64/libcrypto.so.1.0.1e /usr/lib64/libcrypto.so.0.9.8

参考资料:

linux下让apache能够解析php: http://hi.baidu.com/dengyun0302/item/549840396caa7ffae6bb7a61

解决configure: error: libpng.(a|so) not found.:http://blog.csdn.net/alexdream/article/details/7408438

解决php zenddebugger 安装失败:http://blog.csdn.net/dragon8299/article/details/7175932

http://forums.zend.com/viewtopic.php?f=59&t=12423

http://blog.csdn.net/jianfyun/article/details/6434052

http://stackoverflow.com/questions/13467358/zend-debugger-will-not-load

http://forums.zend.com/viewtopic.php?f=57&t=4071

http://sourceforge.net/projects/eaccelerator/postdownload?source=dlp

mysql:http://download.softagency.net/MySQL/Downloads/MySQL-5.1/

mysql-5.1.63(gz)http://download.mysql.cn/src/2012/0531/5603.html

apache/httpd:http://archive.apache.org/dist/httpd/

http://www.zend.com/en/products/studio/downloads

转载请注明出处:怡然之乐 – FineYi

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注