Heim  >  Artikel  >  Backend-Entwicklung  >  centos 下使用 yum 安装php 5.2.17 无法使用mysql_connect、json_encode等函数解决方法

centos 下使用 yum 安装php 5.2.17 无法使用mysql_connect、json_encode等函数解决方法

WBOY
WBOYOriginal
2016-06-13 13:34:091050Durchsuche

centos 下使用 yum 安装php 5.2.17 无法使用mysql_connect、json_encode等函数
原centos系统自带的php版本是 5.1.6,使用yum安装了下php,但观察Configure Command 这行显示的是:

PHP code
<!--

Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/

-->
'./configure' '--build=i686-redhat-linux-gnu' '--host=i686-redhat-linux-gnu' 
'--target=i386-redhat-linux-gnu' '--program-prefix=' '--prefix=/usr' 
'--exec-prefix=/usr' '--bindir=/usr/bin' '--sbindir=/usr/sbin' 
'--sysconfdir=/etc' '--datadir=/usr/share' '--includedir=/usr/include' 
'--libdir=/usr/lib' '--libexecdir=/usr/libexec' '--localstatedir=/var' 
'--sharedstatedir=/usr/com' '--mandir=/usr/share/man' '--infodir=/usr/share/info' '--cache-file=../config.cache' 
'--with-libdir=lib' '--with-config-file-path=/etc' '--with-config-file-scan-dir=/etc/php.d' '--disable-debug' 
'--with-pic' '--disable-rpath' '--without-pear' '--with-bz2' '--with-exec-dir=/usr/bin' 
'--with-freetype-dir=/usr' '--with-png-dir=/usr' '--with-xpm-dir=/usr' 
'--enable-gd-native-ttf' '--without-gdbm' '--with-gettext' '--with-gmp' '--with-iconv' 
'--with-jpeg-dir=/usr' '--with-openssl' '--with-pcre-regex=/usr' '--with-zlib' 
'--with-layout=GNU' '--enable-exif' '--enable-ftp' '--enable-magic-quotes' 
'--enable-sockets' '--enable-sysvsem' '--enable-sysvshm' 
'--enable-sysvmsg' '--with-kerberos' '--enable-ucd-snmp-hack' 
'--enable-shmop' '--enable-calendar' '--without-mime-magic' 
'--without-sqlite' '--with-libxml-dir=/usr' '--enable-xml' 
'--with-system-tzdata' '--with-apxs2=/usr/sbin/apxs' '<span style="COLOR: #e53333">--without-mysql</span>' 
'--without-gd' '--disable-dom' '--disable-dba' 
'--without-unixODBC' '--disable-pdo' '--disable-xmlreader' 
'--disable-xmlwriter' '<span style="COLOR: #e53333">--disable-json</span>' '--without-pspell' 
'--disable-wddx' '--without-curl' '--disable-posix' 
'--disable-sysvmsg' '--disable-sysvshm' '--disable-sysvsem' 


--without-mysql

--disable-json
如上,mysql和json全被禁用了,请问该如何修改这个选项能正常使用json、mysql,谢谢各位!



------解决方案--------------------
可能是yum里没有包含json mysql吧

都自己下源码包
例如json
http://www.aurore.net/projects/php-json/php-json-ext-1.2.1.tar.bz2
然后解压

然后
#phpize
#./configure (详细部分查看 README 啥的)
#make
#make install

自己编译 编译好了 往php.ini添加
extension=xxx.so

重启apache...
Stellungnahme:
Der Inhalt dieses Artikels wird freiwillig von Internetnutzern beigesteuert und das Urheberrecht liegt beim ursprünglichen Autor. Diese Website übernimmt keine entsprechende rechtliche Verantwortung. Wenn Sie Inhalte finden, bei denen der Verdacht eines Plagiats oder einer Rechtsverletzung besteht, wenden Sie sich bitte an admin@php.cn