linux php安装
1.下载新的MySql_server.rpm
rpm -ivh Mysql_server_XXXX.rpm安装server平台
rpm -ivh Mysql_client_xxxx.rpm安装client包
如果你是更新安装的话,可能提示 confict,so replace rpm -ivh 为 rpm
-Uvh
2.安装 apache
tar -zxvf httpd-2.2.6.tar.gz
cd httpd-2.2.6
。/configure——prefix=/usr/local/apache——enable-module=so
make
make install
3.安装 php-5.2.4
tar -zxvf php-5.2.4.tar.gz
cd php-5.2.4
。/configure——prefix=/usr/local/php ——with-apxs2=/usr/local/apache2/bin/apxs
——with-config-file-path=/usr/local/lib——with-mysql
make
make install
cp php.ini-dist /usr/local/lib/php.ini
4.配置
vi /usr/local/apache/conf/httpd.conf对apache做如下配置
#ServerAdmin一行改为您的邮箱地址
#DocumentRoot "/home/httpd/html/" 此处为html文件主目录
#Options FollowSymLinks MultiViews为安全起见,去掉"Indexes"
# DirectoryIndex default.php default.phtml default.php3 default.html
default.htm
#
# 设置apache的默认文件名次序
#AddType application/x-httpd-php .php .phtml .php3 .inc
#AddType application/x-httpd-php-source .phps
# 设置php 文件后缀
存盘退出
vi /usr/local/lib/php.ini
#register-golbals = On
存盘退出
5.启动apache
/usr/local/apache2/bin/apachectl start
如果提示一下错误:
Can not load /usr/local/apache2/modules/libphp5.so into server:
/usr/local/apache2/modules/libphp5.so :
Can't restore segment prot after reloc: Permission denied
Linux
因为无法加载php 模块,在调试PHP 程序是提示下载php ,或者显示php 源
代码,解决方法:
修改 httpd.conf
LoadModule php5_module modules/libphp5.so
AddType application/x-httpd-php .php
执行:chcon /usr/local/apache2/modules/libphp5.so -t shlib_t
注销系统重新进入
/usr/local/apache2/bin/apachectl start