四 LAMP
1.卸载PHP
rpm -e php --nodeps
2.安装加密工具
数据加密工具libmcrypt、mhash、mcrypt
(1)安装libmcrypt
tar zxf libmcrypt-2.5.8.tar.gz -C /usr/src/
cd /usr/src/libmcrypt-2.5.8/
./configure
make && make install
ln -s /usr/local/lib/libmcrypt. /usr/lib/
(2) 安装mhash
tar zxf mhash-0.9.9.9.tar.gz -C /usr/src/
cd /usr/src/mhash-0.9.9.9/
./configure
make && make install
ln -s /usr/local/lib/libmhash /usr/lib/
(3) 安装mcrypt
tar zxf mcrypt-2.6.8.tar.gz -C /usr/src/
cd /usr/src/mcrypt-2.6.8/
export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH
./configure
make && make install
3.安装PHP
tar zxf php-5.3.28.tar.gz -C /usr/src/
cd /usr/src/php-5.3.28/
./configure --prefix=/usr/local/php5
--with-mcrypt --with-apxs2=/usr/local/httpd/bin/apxs
--with-mysql=/usr/local/mysql --with-config-file-path=/usr/local/php5
--enable-mbstring
make
make install
4.配置文件/usr/local/php5/php.ini调整
(1)复制模板:cp /usr/src/php-5.3.28/php.ini-development /usr/local/php5/php.ini
(2)修改配置: vim /usr/local/php5/php.ini
default_charset = "utf-8”
file_uploads = On
upload_max_filesize = 2M
max_file_uploads = 20
post_max_size = 8M
short_open_tag = On
(3)添加zend优化模块
tar zxf ZendGuardLoader-php-5.3-linux-glibc23-x86_64.tar.gz -C /usr/src/
cd /usr/src/ZendGuardLoader-php-5.3-linux-glibc23-x86_64/php-5.3.x/ 、
cp ZendGuardLoader.so /usr/local/php5/lib/php/
vim /usr/local/php5/php.ini
zend_extension=/usr/local/php5/lib/php/ZendGuardLoader.so
zend_loader.enable=1
5.apache配置文件修改
vim /usr/local/httpd/conf/httpd.conf
LoadModule php5_module modules/libphp5.so (注:如果正常,则自动填写)
AddType application/x-httpd-php .php (注:需要个人添加)
DirectoryIndex index.php index.html
6.重启Apache
/usr/local/httpd/bin/apachectl restart
7.测试PHP能否正确显示
vim /usr/local/httpd/htdocs/test1.php
<?php
phpinfo( );
?>
8.测试数据库能否正常访问
vi /usr/local/httpd/htdocs/test2.php
<?php
$link=mysql_connect(‘localhost‘,‘root‘,‘123456‘);
if($link) echo "恭喜你,数据库连接成功啦!!";
mysql_close();
?>
9.配置phpMyAdmin数据库管理套件
(1)解包,并复制到网站目录
tar zxf phpMyAdmin-4.2.5-all-languages.tar.gz
mv phpMyAdmin-4.2.5-all-languages/ /usr/local/httpd/htdocs/phpMyAdmin
(2)建立配置文件config.inc.php
cd /usr/local/httpd/htdocs/phpMyAdmin
cp config.sample.inc.php config.inc.php
(3)在浏览器访问http://域名或IP/phpMyAdmin/
原文地址:http://blog.51cto.com/13550558/2087772