更多设置请参考 [Redhat Linux下MySql数据库的安装配置及简单操作]
安装php
PHP需要libgmp.so.3、php-cli、php-common的支持
[ [email protected] ~]# rpm -ivh /media/Server/php-5.1.6-5.el5.i386.rpm
warning: /media/Server/php-5.1.6-5.el5.i386.rpm: Header V3 DSA signature: NOKEY, key ID 37017186
error: Failed dependencies:
libgmp.so.3 is needed by php-5.1.6-5.el5.i386
php-cli = 5.1.6-5.el5 is needed by php-5.1.6-5.el5.i386
php-common = 5.1.6-5.el5 is needed by php-5.1.6-5.el5.i386
libgmp.so.3安装
[ [email protected] ~]# rpm -ivh /media/Server/gmp-4.1.4-10.el5.i386.rpm
warning: /media/Server/gmp-4.1.4-10.el5.i386.rpm: Header V3 DSA signature: NOKEY, key ID 37017186
Preparing... ########################################### [100%]
1:gmp ########################################### [100%]
安装php-common
[ [email protected] ~]# rpm -ivh /media/Server/php-common-5.1.6-5.el5.i386.rpm
warning: /media/Server/php-common-5.1.6-5.el5.i386.rpm: Header V3 DSA signature: NOKEY, key ID 37017186
Preparing... ########################################### [100%]
1:php-common ########################################### [100%]
[ [email protected] ~]#
安装php-cli
[ [email protected] ~]# rpm -ivh /media/Server/php-cli-5.1.6-5.el5.i386.rpm
warning: /media/Server/php-cli-5.1.6-5.el5.i386.rpm: Header V3 DSA signature: NOKEY, key ID 37017186
Preparing... ########################################### [100%]
1:php-cli ########################################### [100%]
[ [email protected] ~]#
安装PHP
[ [email protected] ~]# rpm -ivh /media/Server/php-5.1.6-5.el5.i386.rpm
warning: /media/Server/php-5.1.6-5.el5.i386.rpm: Header V3 DSA signature: NOKEY, key ID 37017186
Preparing... ########################################### [100%]
1:php ########################################### [100%]
[ [email protected] ~]#
另外还需要安装PHP-MySql,PHP-MySql需要php-pdo的支持
安装php-pdo
[ [email protected] ~]# rpm -ivh /media/Server/php-pdo-5.1.6-5.el5.i386.rpm
warning: /media/Server/php-pdo-5.1.6-5.el5.i386.rpm: Header V3 DSA signature: NOKEY, key ID 37017186
Preparing... ########################################### [100%]
1:php-pdo ########################################### [100%]
[ [email protected] ~]#
安装PHP-MySql
[ [email protected] ~]# rpm -ivh /media/Server/php-mysql-5.1.6-5.el5.i386.rpm
warning: /media/Server/php-mysql-5.1.6-5.el5.i386.rpm: Header V3 DSA signature: NOKEY, key ID 37017186
Preparing... ########################################### [100%]
1:php-mysql ########################################### [100%]
[ [email protected] ~]#
测试配置:
编译安装php之后都需要手动修改Apache的配置文件,这里不需要修改,安装PHP时会生成一个/etc/httpd/conf.d/php.conf 文件,Apache配置文件可以直接饮用这个配置
#
# PHP is an HTML-embedded scripting language which attempts to make it
# easy for developers to write dynamically generated webpages.
#
LoadModule php5_module modules/libphp5.so
#
# Cause the PHP interpreter to handle files with a .php extension.
#
AddHandler php5-script .php
AddType text/html .php
#
# Add index.php to the list of files that will be served as directory
# indexes.
#
DirectoryIndex index.php
#
# Uncomment the following line to allow PHP to pretty-print .phps
# files as PHP source code:
#
#AddType application/x-httpd-php-source .phps
如果是编译安装的话只需要将上面红色的文字加到/etc/httpd/conf.d/php.conf 配置文档中就可以了。
php的配置文件在/etc/php.ini ,也不需要修改,除非你需要配置一些高级功能。
MySql的配置文件在/etc/my.cnf。
启动Apache和MySql服务
在网页目录下建立一个php测试文件,如果能出现正确的php环境信息说明安装已经成功。
<?
phpinfo();
?>
上传一个WordPress程序到/var/www/html/目录下,将其目录的权限修改为777,进行WordPress安装测试,这样一个LAMP环境就搭建起来了。
|