日期:2014-05-16  浏览次数:20803 次

Linux上简单配置安装cacti(二)php安装
Linux上简单配置安装cacti(二)php安装

3.php5.3.1服务器安装
php首页
http://cn2.php.net/
下载得到文件
php-5.3.1.tar.gz
解开压缩
tar zxvf php-5.3.1.tar.gz
进入安装目录
cd php-5.3.1/
创建oracle驱动目录
mkdir /usr/lib/oracle
mkdir /usr/lib/oracle/10.2.0.3
mkdir /usr/lib/oracle/10.2.0.3/client
mkdir /usr/lib/oracle/10.2.0.3/client/lib
拷贝classes12.jar驱动过去吧,不是很理解这里为啥还要oracle驱动,不过照着别人的BLOG去做的
开始安装
./configure --with-apxs2=/usr/local/apache2/bin/apxs --with-mysql=/usr/local/mysql/ --with-oci8=share,instantclient,/usr/lib/oracle/10.2.0.3/client/lib
报错如下:
checking Oracle Instant Client directory... /usr/lib/oracle/10.2.0.3/client/lib
checking Oracle Instant Client SDK header directory... configure: error: Oracle Instant Client SDK header files not found

下载安装一下算了,不是上面classes12.jar那么简单的:(
下载安装地址
http://www.oracle.com/technology/software/tech/oci/instantclient/htdocs/linuxsoft.html
下载的文件:
instantclient-sdk-linux32-11.2.0.1.zip
instantclient-basic-linux32-11.2.0.1.zip
新增目录
mkdir -p /opt/oracle/instantclient
将两个文件拷贝到刚才新增的工作目录
mv instantclient-* /opt/oracle/instantclient/
解开压缩
unzip instantclient-basic-linux32-11.2.0.1.zip
unzip instantclient-sdk-linux32-11.2.0.1.zip

echo /opt/oracle/instantclient >> /etc/ld.so.conf
ldconfig
手工增加link
ln -s libclntsh.so.11.1 libclntsh.so
ln -s libocci.so.11.1 libocci.so

在到php那边试试
./configure --with-apxs2=/usr/local/apache2/bin/apxs --with-mysql=/usr/local/mysql/ --with-oci8=share,instantclient,/opt/oracle/instantclient

成功了:),继续下一步:
make
make install
安装php成功!

按照要求拷贝配置文件
cp php.ini-dist /usr/local/lib/php.ini
确发现我本机没有php.ini-dist
检查目录
dir php.ini*
返回如下:
php.ini-development php.ini-production

所以执行
cp php.ini-production /usr/local/lib/php.ini

修改php配置
vi /usr/local/lib/php.ini
找到如下内容:
register_globals = Off
改为:
register_globals = On

修改apache配置:
vi /usr/local/apache2/conf/httpd.conf
找到下面字段:
DirectoryIndex
在index.html前面添加index.php
并在配置文件最后加入如下字段:
AddHandler php5-script .php
AddType text/html .php
测试PHP是否正常运行:
#vi /usr/local/apache2/htdocs/index.php
写入下面一行:
<?php phpinfo() ?>
保存退出后重新启动apache
#/usr/local/apache2/bin/apachectl restart
访问
http://10.206.19.59
得到结果如下:
System Linux dev1.sccl.cn 2.6.9-42.EL #1 Wed Jul 12 23:16:43 EDT 2006 i686
Build Date Dec 19 2009 14:33:47
Configure Command './configure' '--with-apxs2=/usr/local/apache2/bin/apxs' '--with-mysql=/usr/local/mysql/' '--with-oci8=share,instantclient,/opt/oracle/instantclient'
Server API Apache 2.0 Handler
Virtual Directory Support disabled
Configuration File (php.ini) Path /usr/local/lib
Loaded Configuration File /usr/local/lib/php.ini

php安装成功了:)