linux中phpmyadmin_linux中PHP 5.6编译安装方法(支持ORACLE/MARIADB数据库)

时间:2019-08-22  来源:linux  阅读:

大多数phper编译php的时候,的模式都很固定,简单的支持一些常见拓展 支持mysql就够了,而且这些phper们偏爱php5.2 php5.3 连php5.4都很少,很不愿意尝试编译新的版本,以后就固定用这个版本,用固定的编译代码。这样虽然很安全。但是我们应该开拓创新。

环境:Linux CentOS 7
PHP版本:php 5.6.1
目的:支持MariaDB(Mysql), Oracle数据库拓展 以及支持常用拓展组件

事先安装好了MariaDB,MariaDB跟Mysql差不多,此处不详细说明

先上段,尝试成功的编译代码(去掉oracle支持 去掉ldap支持)

 代码如下

./configure --prefix=/usr/local/php --with-config-file-path=/usr/local/php/etc --with-config-file-scan-dir=/usr/local/php/etc/php.d --with-mysql=/usr/local/mysql --with-mysqli=/usr/local/mysql/bin/mysql_config --with-pdo-mysql --with-iconv --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib --with-libxml-dir=/usr --enable-xml --disable-rpath --enable-bcmath --enable-shmop --enable-sysvsem --enable-inline-optimization --with-curl --enable-mbregex --enable-fpm --enable-mbstring --with-mcrypt --with-gd --enable-gd-native-ttf --with-mhash --enable-pcntl --enable-sockets --with-xmlrpc --with-openssl --enable-soap --enable-zip

然后拷贝php.ini到安装目录

把编译的目录下的 ./php-5.6.1/php.ini-production 拷贝到/usr/local/php/etc/php.ini

上面这段编译配置代码是在我尝试了很多次总结出来的,一去掉了一些编译配置(oracle 和 ldap配置),折腾了很久最终还是放弃在编译php过程中的oralce编译参数和ldap编译参数,如:

 代码如下

--with-oci8=shared,instantclient,/usr/local/lib64/oracle/client/lib --with-pdo-oci=instantclient,/usr/local/lib64/oracle/client/lib,12.1 --enable-opcache --with-ldap --with-ldap-sasl

其中–enable-opcache 没有尝试

PHP各版本说明:

PHP 5.5 开始增加 –enable-opcache参数,意思是启用Zend Opcache缓存功能,类似APC缓存
PHP 5.4 去掉了参数 –enable-safe-mode –enable-discard-path –enable-fastcgi –enable-force-cgi-redirect

但是Oracle,哥们儿我是要用的,怎么能少了你,继续折腾
执行 pecl install oci8 在需要录入的地方输入 shared,instantclient,/usr/local/lib64/oracle/client/lib
其中 /usr/local/lib64/oracle/client/lib 是在官网下载的几个oracle sdk

 代码如下

[root@joe-pc bin]# /usr/local/php/bin/pecl install oci8
downloading oci8-2.0.8.tgz ...
Starting to download oci8-2.0.8.tgz (190,854 bytes)
.........................................done: 190,854 bytes
11 source files, building
running: phpize
Configuring for:
PHP Api Version:         20131106
Zend Module Api No:      20131226
Zend Extension Api No:   220131226
Please provide the path to the ORACLE_HOME directory. Use "instantclient,/path/to/instant/client/lib" if you"re compiling with Oracle Instant Client [autodetect] : shared,instantclient,/usr/local/lib64/oracle/client/lib

在php配置文件里加入oracle支持

编辑 /usr/local/php/etc/php.d/oracle.ini 内容:


extension=oci8.so

启动 php-fpm,妈的报错

NOTICE: PHP message: PHP Warning: PHP Startup: Unable to load dynamic library "/usr/local/php/lib/php/extensions/no-debug-non-zts-20131226/oci8.so" - libaio.so.1: cannot open shared object file: No such file or directory in Unknown on line 0

看来这oracle 还缺少libaio支持,也给装上

yum install libaio

然后kill掉php所有进程,重启 php-fpm


/usr/local/php/sbin/php-fpm

ok, 终于搞定了,生命在于折腾

linux中phpmyadmin_linux中PHP 5.6编译安装方法(支持ORACLE/MARIADB数据库)

http://m.bbyears.com/caozuoxitong/63698.html

推荐访问:在linux中 linux怎么读 linux系统
相关阅读 猜你喜欢
本类排行 本类最新