centos7下面php5.6添加postgresql相关扩展【试行】

来源:互联网 发布:c语言计算 编辑:程序博客网 时间:2024/06/14 06:18

下载相关资源

首先,请下载PDO_PGSQL及pq两个扩展包源码。
PDO_PGSQL

pq

我下的是:
这里写图片描述

请上传到centos服务器。
这里写图片描述
上传完毕。

解压及编译

解压后,分别编译扩展。
编译pq扩展
步骤如下:
这里写图片描述

注意,使用phpize的时候需要到扩展根目录用,否则会出现上图的提醒。

设定需要编译的php config路径,注意我的php config在:
这里写图片描述

/usr/bin/php-config

请根据实际选用路径。

./configure --with-php-config=/usr/bin/php-config

这里写图片描述
错误,需要指定pg_config才行。
注意,我的机器pg config在:请自行替换路径

这里写图片描述

./configure --with-pgsql=/usr/pgsql-9.6/bin/pg_config --with-php-config=/usr/bin/php-config

还是错误,查找原因得知:
https://stackoverflow.com/questions/4293111/postgresql-pg-config-bash-pg-config-command-not-found

up vote13down votefavoriteI'm on a Mac building an app in Rails 3 with PostgreSQL...PostgreSQL is working fine but in the command line I get the following error:$ pg_config-bash: pg_config: command not foundAnyone know how to get this setup so I can run pg_config?Thanksbash unix postgresql shell pathshareimprove this questionedited Nov 27 '10 at 19:25jira2,662920asked Nov 27 '10 at 18:08AnApprentice27k114398725add a comment5 Answersactive oldest votesup vote38down voteacceptedyou can install postgresql-devel to get that. in rpm based distroyum install postgresql-develwill workor useyum provides "*/pg_config"to get the exact packageshareimprove this answeranswered Nov 27 '10 at 22:05Unni76316123       For those who find this answer, this program is now part of the package libpq-dev – Walt W Sep 27 '11 at 20:043       on Ubuntu: sudo apt-get install libpq-dev – tflutre Nov 25 '11 at 18:572       For those who find this answer, I still found this program in postgresql-devel in the CentOS Updates repo with CentOS 5.5 – MattSayar Jul 26 '12 at 22:342       Find it finally, thank you. I'm on CentOS and after yum provides I run: python26 setup.py install build_ext --pg-config /usr/pgsql-9.2/bin/pg_config to run on python 2.6 / postgre 9.2 – chirale Mar 25 '13 at 15:482       +1 for mentioning "provides" – Christian Oct 3 '14 at 12:48show 1 more commentup vote2down voteMy problem was that pg_config was not in the PATH. So, I first needed to search for pg_config's path by usingyum provides "*/pg_config"After noting the path, I used this command to install pg gemgem install pg -- --with-pg-config=/usr/pgsql-9.4/bin/pg_configThat installed pg successfully. The system was a CentOS.shareimprove this answeranswered Apr 14 '16 at 15:46Anwar6051120Confirmed with Fedora 24: dnf install postgresql-devel gem install pg -- --with-pg-config=/usr/pgsql-9.4/bin/pg_config – amoyer Jun 30 '16 at 2:51 add a commentup vote1down voteIn addition to installing postgresql-devel I had to modify the PATH environment variable. E.g. add this to your .bashrc:export PATH="$PATH:/usr/pgsql-9.4/bin"shareimprove this answeranswered Oct 27 '16 at 9:57dimid2,5691741add a commentup vote0down votepg_config comes with the development files for PostgreSQL. Go to where you got the server daemon from and look for them there.shareimprove this answeranswered Nov 27 '10 at 19:29Ignacio Vazquez-Abrams482k748681006add a commentup vote0down votei have a CentOS 5.11 with postgres 9.0, and python 2.4 , python 2.6 to run openERP 6, trying to install the psycopg2 i allways get the error:# python26 setup.py install --with-xslt-config=/usr/local/bin/xslt-config --with-xml2-config=/usr/local/bin/xml2-configusage: setup.py [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]   or: setup.py --help [cmd1 cmd2 ...]   or: setup.py --help-commands   or: setup.py cmd --helperror: option --with-xslt-config not recognizedfrom :how to install pg_config Later i do :yum provides "*/pg_config"i get a list, where we can findpostgresql84-devel-8.4.20-1.el5_10.x86_64 : PostgreSQL development header     files                                          : and librariesRepo        : baseMatched from:Filename    : /usr/bin/pg_configbut if i try to install, its already installed So i useyum provides "*/pg_config"later you need install the rigth vertion, for your architecture(32bit or 64bit), in my case was:yum install postgresql84-devel-8.4.20-1.el5_10.x86_64then updateyum updateand finally install psycopg2 with pippip install psycopg2

好了,执行:

export PATH="$PATH:/usr/pgsql-9.6/bin"然后继续执行:./configure  --with-php-config=/usr/bin/php-config

出现:
这里写图片描述

raphf扩展的编译安装

到:
raphf
下载安装包,然后解压编译。
这里写图片描述
这里写图片描述

打开目录

这里写图片描述

执行:phpize执行:./configure  --with-php-config=/usr/bin/php-config

结果如下:
这里写图片描述

这里写图片描述

没有问题,那么正式编译

make && make install

如图:
这里写图片描述

这里写图片描述

莫名其妙的错误,解决方案:

centos编译yaf时make出错

这里写图片描述

这里写图片描述

执行:yum install pcre-dev
还是报错,找到了说法:

[Unknown type name ‘zend_string’

](https://stackoverflow.com/questions/34264584/unknown-type-name-zend-string)

I am trying to compile APCu cache extension using make && make install.I get a compilation error regarding not being able to find zend_string or zend_long. Do you guys know what extension I would need for these?APCuThanks :)php makefile apc php-5.6shareedited Dec 14 '15 at 13:57Machavity20.8k133964asked Dec 14 '15 at 10:22Kal94711743Nevermind got it from pecl instead pecl install APCu-4.0.10. – Kal Dec 14 '15 at 10:321       Those are PHP 7 type names. You're not using the right version of the extension. – Andrea Dec 14 '15 at 20:33Yeah realized it should be version 4.0.10. Thank. Answer is and I'll accept :) – Kal Dec 20 '15 at 12:13add a comment2 Answersactive oldest votesup vote3down voteacceptedThose types only exist in PHP 7/Zend Engine 3. You need the PHP 5 version of the extension.shareanswered Dec 20 '15 at 16:43Andrea10.1k22150see dependencies pecl.php.net/package/APCu for compatible versions – Stuart Cardall Jan 26 '16 at 12:46add a commentup vote1down voteI try to run:./configure --with-php-config=/usr/local/php7/bin/php-configreplace./configureSuccess.share

还是外国的网站全一点,意思是这个版本的扩展可能是针对php7的,需要找一个适合php5的扩展。
请回到
http://pecl.php.net/package/raphf
然后下载1.1.2的版本,2.0以上版本是php7的。
这里写图片描述
这里写图片描述

打开目录,运行phpize运行./configure --with-php-config=/usr/local/php7/bin/php-config运行make && make install成功。

这里写图片描述

这里写图片描述

这里写图片描述

这里写图片描述

好了,现在这样就是编译成功了,那么我们编译的so文件在哪里???

这里写图片描述

这里写图片描述

在两个地方都有,不过我们当然用的是:

/usr/lib64/php/modules/raphf.so

这个文件了。

-- 打开配置文件vi /etc/php.ini-- 加入扩展编辑/etc/php.ini文件加入配置项extension=raphf.so

就是这样

这里写图片描述

然后重启php-fpm

systemctl restart php-fpm

pq扩展的编译安装

还记得我们的目的吗?我们是要编译pq的。
那么,返回pq的目录然后执行:

phpize运行./configure --with-php-config=/usr/local/php7/bin/php-config运行make && make install

然而到了最后一步出现了错误:
这里写图片描述

zend_string 只有php7才有,那么我们采用的版本可能太新了。

回到http://pecl.php.net/package/pq然后看到:

这里写图片描述

所有只能用版本1.0以上
这里写图片描述

然后重复扩展的编译过程

phpize运行./configure --with-php-config=/usr/local/php7/bin/php-config运行make && make install

成功,然后看看是不是生成so文件了:
这里写图片描述

done
-- 打开配置文件vi /etc/php.ini-- 加入扩展编辑/etc/php.ini文件加入配置项extension=pq.so

这里写图片描述

重启:

systemctl restart php-fpm

编译PDO_PGSQL扩展

打开目录,执行:

phpize运行./configure --with-php-config=/usr/local/php7/bin/php-config运行make && make install

到config的时候出现错误:
这里写图片描述

解决方案
stackoverflow

up vote29down voteIf you use home brew, you can solve this with a command as simple as:brew install php55-pdo-pgsqlfor other php version, search with:brew search pgsqlshareimprove this answeranswered Sep 20 '15 at 3:19Daniel Cukier4,198945881       This is the better answer (+1). The currently accepted answer suggests to use brew to install autoconf and then to compile PHP from source code. Which is unnecessary work, because you can directly install PostgreSQL, PHP and the phpXX-pdo-pgsql packages - all using brew for Mac OSX. – Alexander Farber Mar 12 '16 at 13:36 I tried this and the install is successful (I see pdo_pgsql in php -i) but I still get pg_connect() not found errors.. – Nic Cottrell May 30 '16 at 8:451       Actually, this is a better answer. Because almost all developers use some kind of packet manager these days. – Turdaliev Nursultan Nov 23 '16 at 12:38add a commentup vote8down voteThis worked for me with OSX 10.9.4 «Mavericks»Install sourcesDownload the PHP source code. Unlike on Mountain Lion, you don’t get any headers preinstalled to link against so need to put it in /usr/include/php. Mavericks ships with PHP 5.4.17, but the latest 5.4.x source from php.net should do:tar -jxvf php-5.4.20.tar.bz2sudo mkdir -p /usr/includesudo mv php-5.4.20 /usr/include/phpConfigure PHPcd /usr/include/php./configure --without-iconvsudo cp /etc/php.ini.default /etc/php.iniBuilding a moduleI needed the pdo_pgsql module - the same pattern should apply to just about any module assuming you have the necessary dependencies installed:cd ext/pdo_pgsqlIn my case I had the following error:Cannot find autoconf. Please check your autoconf installation and the $PHP_AUTOCONF environment variable. Then, rerun this script. ERROR: `phpize' failedSo I had to use this command:brew install autoconfThen:phpizeAfter that I tried to do: ./configurebut I had the next problem:checking for pg_config... not found configure: error: Cannot find libpq-fe.h. Please specify correct PostgreSQL installation pathSo the solution was to specify correct PostgreSQL installation path:./configure --with-pdo-pgsql=/Library/PostgreSQL/9.3/makesudo make installThat copies pdo_pgsql.so to /usr/lib/php/extensions/no-debug-non-zts-20100525.Then simply addextension=pdo_pgsql.so to /etc/php.ini Run php -m to confirm everything went to plan.shareimprove this answeranswered Aug 7 '14 at 20:26Jorge Casariego11.2k443632       Your approach also works for Yosemite. The only caveats are: to use ./configure --with-pgsql=/usr/local/Cellar/postgresql/9.4.1/ in case of PHP 5.5.20; add extension=pgsql.so to /etc/php.ini (originally php.ini.default). – Igor de Lorenzi Jun 9 '15 at 17:53 add a commentup vote5down voteFor those who installed php7/ngix/postgres with homebrewYou can install the PostgreSQL module with:brew install php70-pdo-pgsqlAfter that, you have to restart the php service:brew services restart php70shareimprove this answeranswered Aug 14 '16 at 18:17ricardo440721add a commentup vote3down voteI killed the whole day trying to make it work on El Capitan after I made an upgrade yesterday and it turned out that I forgot to modify httpd.conf and change the path from the default php module (version 5.5.27) to the one I installed (version 5.6.14). This should be done in httpd.conf by modifying your default LoadModule php5_module path to LoadModule php5_module /usr/local/opt/php56/libexec/apache2/libphp5.so. Just decided to leave it here as the potential solution for those who upgrade their OS or just the PHP version and face the same problem.shareimprove this answeranswered Oct 11 '15 at 20:53ievgenii12429add a commentup vote3down voteOS X El Capitan users can simply upgrade their version of PHP 5.6. This is a one liner that will do that.curl -s http://php-osx.liip.ch/install.sh | bash -s 5.6shareimprove this answeranswered Feb 1 '16 at 14:05Christopher Charles Gorman391add a commentup vote2down votePostgreSQL by default is installed in a unusual place on MAC OS X:/Library/PostgreSQL/9.3Given the location above you can type this:./configure --with-pgsql=/Library/PostgreSQL/9.3shareimprove this answeredited Mar 14 '14 at 14:46Brad Koch8,14196286answered Jan 22 '14 at 5:10YP Leung13113add a commentup vote2down voteFor php56 via brew:brew install php56-pdo-pgsqlshareimprove this answeranswered Jun 9 '16 at 2:34ThangTD521381       I'm on Sierra, and this didn't work for me. Install completed, but no pdo_pgsql appears in in phpinfo() – Black Nov 28 '16 at 4:08 Hi @Francis, did you check by php -i | grep pdo_pgsql in terminal ? Or restart your webserver to see in browser. Refer to my screen shot: prnt.sc/dcmkcp – ThangTD Nov 28 '16 at 4:11 Hi - found the issue. Sierra Server of course has at least two PHP instances with their own php.ini files; one in /private/etc and the other in /Applications/Server.app/Contents/ServerRoot/private/etc/php‌​.ini. Thanks – Black Nov 28 '16 at 4:441       Yeah, I intent to tell you to make sure whether php version and its location are correct. Better you should use php with homebrew, not the default one. Because its config will lose when you upgrade your MacOS – ThangTD Nov 28 '16 at 4:47add a commentup vote0down voteFor those of you having openssl error while make here is the solutionOSX uses openssl 0.98 while installer is searching for 1.0.0refer this link for instructionspsycopg2 installation error - Library not loaded: libssl.dylibshareimprove this answeredited 2 days agoCommunity♦11answered Apr 18 '14 at 9:49Majky749425add a commentup vote0down voteI downloaded PostgreSQL for Mac, and used the stack builder after installation to standup the entire EnterpriseDB Apache/PHP stack end-to-end. I mention this as a possible time saving option, probably not ideal for all situations. Should work OK if the apache and postgres shipped with Mac OS X were never started.To keep existing apache hosted applications (i.e. pre-PostgreSQL install legacy) stable, I would just install the newer EnterpriseDB apache on port 81 (stackbuilder will prompt for new port if legacy apache instance is already running). Then, use mod_proxy in httpd.conf for the apache running on port 80 to provide seamless user experience to applications hosted on PostgreSQL.shareimprove this answer

重点在于:
这里写图片描述

需要将pgsql的路径传过去。
注意,网上一大堆解决方案谬论:
例如:
这里写图片描述

文章作者真的有试过吗??可行吗?

重新执行几个步骤,不同的是config的时候要带pgsql的路径:

phpize运行./configure  --with-pdo-pgsql=/usr/pgsql-9.6/  --with-php-config=/usr/bin/php-config运行make && make install

第二步config成功:
这里写图片描述

第三步编译成功

这里写图片描述

而且,生成so文件在:

/usr/lib64/php/modules/pdo_pgsql.so

那么,打开php.ini添加扩展,然后重启php。

-- 打开配置文件vi /etc/php.ini-- 加入扩展编辑/etc/php.ini文件加入配置项extension=pdo_pgsql.so

这里写图片描述

systemctl restart php-fpm

好了,运行phpinfo的页面看看扩展是不是生效了。

这里写图片描述

可惜的是,我只看到raphf生效,而pq和pdo那个没有踪影,查找解决方案:
pgsql-so-is-not-loaded-in-php

Ask Questionup vote7down votefavorite1I've been tasked to create a PHP app which accesses an existing PostgreSQL database. This is my first time working with Postgre, not to mention the PHP has already been installed in the Linux box on which the app is supposed to run. I have no experience setting up this stuff, I just code.My question is that I can't seem to get the Postgre extension working in PHP. I checked the php.ini file, there were no "extension=..." lines. So I added "extension=pgsql.so". I then checked the "extension_dir" and found that there were only 2 files in there (ldap.so, phpcups.so), I added a pgsql.so file taken from another Linux box. I restarted httpd. And it does not work. I couldn't find any "pgsql" or "postgre" in phpinfo().Forgive my noobness. I know too little Linux. I would really appreciate it if you can point me to the right direction.I used the suggestion given by number5:Dude, I'm on RedHat. I used the "yum" version of the command you gave, and I got this:[root@perseus ~]# yum install php-pgsql Loading "installonlyn" plugin Setting up Install Process Setting up repositories Could not retrieve mirrorlist http://mirrorlist.centos.org/?release=5&arch=x86_64&repo=extras error was [Errno 4] IOError: Error: Cannot find a valid baseurl for repo: extrasUNFORTUNATELY, the Linux server I'm using is NOT connected to the Internet. Any other way to install?php apache php-extensionshareimprove this questionedited May 14 '10 at 8:47asked May 14 '10 at 7:35Obay1,430637601       That looks like a question for ServerFault. – Vladislav Rastrusny May 14 '10 at 8:22hope you already solved your problem. If not, you can download the required rpms and install using rpm command. wget mirrors.gigenet.com/centos/5.4/os/x86_64/CentOS/… wget mirrors.gigenet.com/centos/5.4/os/x86_64/CentOS/… rpm -ivh *.rpm if it tells you that some deps are missing, you can find it here mirrors.gigenet.com/centos/5.4/os/x86_64/CentOS the download link is assuming that your CentOS is 5.4 x86_64 – number5 May 16 '10 at 15:31thanks number5, super! – Obay May 17 '10 at 9:04add a comment4 Answersactive oldest votesup vote9down voteacceptedIt depends on which Linux distro you are using.If you are using Ubuntu/Debian, you need to:sudo apt-get install php5-pgsqlFedora/CentOSyum install php-pgsqlusually you can find out which distro you are on by:ls /etc/*-releaseshareimprove this answeranswered May 14 '10 at 7:51number57,88413145Dude I added some comments above – Obay May 14 '10 at 8:05add a commentup vote3down voteOn CentOS extensions create separate *.ini file one per each php extension in /etc/php.dSo, don't alter main *.ini file, but create /etc/php.d/pgsql.ini and add there a lineextension=pgsql.soThen you will need to restart Apache usingservice httpd restartBut the best automated way is to just typeyum install php-pgsqlIn your case that didn't work because of some problems in yum configuration. Go to /etc/yum-repos.d Typenano /etc/yum.repos.d/CentOS-Base.repoScroll down to [extras] section and ensure it is like this:#additional packages that may be useful[extras]priority=1name=CentOS-$releasever - Extras=extras#baseurl=http://mirror.centos.org/centos/$releasever/extras/$basearch/gpgcheck=1gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5Correct it if needed, save file (Ctrl-X) and do the following:yum clean allyum upgradeAfterwards try to repeatyum install php-pgsqlshareimprove this answeranswered May 14 '10 at 8:21Vladislav Rastrusny18.8k1362131it says: Config Error: File contains parsing errors: file://///etc/yum.repos.d/CentOS-Base.repo [line 41]: '=extras\n' – Obay May 14 '10 at 8:33Who says? What's your CentOS version? May be, you should remove "priority" string? – Vladislav Rastrusny May 14 '10 at 11:21add a commentup vote1down voteRemove the .so file you've copied from the other machine (though it might work, there's no need to take the risk)Use the distribution's package manager to install the php_pgsql/php5_pqsql moduleRestart the apache and try again. Maybe the module has been added to an .ini file automagicallyIf not, run <?php echo 'ini: ', get_cfg_var('cfg_file_path'); to see which php.ini you have to editedit this ini filerestart the apacheshareimprove this answeranswered May 14 '10 at 7:52VolkerK76.3k13131196add a commentup vote-2down voteMy operation system Linux mint kde and there was same issuepg_connect()You must install if you are use php5.6sudo apt-get install php5.6-pgsqlAfter you must change extention name in "php.ini" file.;extension=php_pgsql.dll'dll' to 'so'For exampleextension=php_pgsql.soshareimprove this answeredited Jan 13 at 17:53answered Jan 13 at 17:44Vugar Ahmedoglu121       This seems like a different issue. For a start, the OP already had that config line exactly as written. – BoundaryImposition Jan 13 at 17:59add a commentYour Answer

centos下面安装php扩展的几种方法

https://my.oschina.net/u/2400083/blog/518195

Centos下,PHP有多种方式来安装拓展, 主要有 包管理式的yum安装、pecl安装, 以及底层的源码编译安装。包管理式的安装卸载尤为方便,而源码编译式的安装则方便参数调优。一般的搭建本机开发环境推荐包管理式的安装,节约时间。而线上部署环境则推荐编译安装, 方便调优。yum安装## yum方式安装能自动安装拓展的.so动态库,并配置好php.ini# 如安装mysql拓展yum search mysql|grep php  #我们搜索到拓展名为 php-mysql.x86_64sudo yum install php-mysql  #这样php-mysql拓展便安装好了# 如果出现拓展版本和php版本冲突问题, 可安装如下任意yum源:sudo yum install atomic-release.noarchsudo yum install webtatic-release.noarch# 这些源提供了其他版本的php拓展,同时每个源针对特定拓展都会提供多个版本,你只需安装一个源即可。如:atomic源下能搜索到5.4版的mysql拓展  atomic-php54-php-mysql.x86_64 webtatic源下能搜索到5.5版本的mysql拓展 php55w-mysql.x86_64pecl安装# 我们需要先从pear官网下载 go-pear 工具# 这个工具将帮我们同时安装 pecl包管理器(管理php的C拓展) pear包管理器(管理php类库)wget http://pear.php.net/go-pear.phar# 安装工具# 安装过程除非特别指定,否则默认将工具安装到 /home/用户名/pear/bin 目录下php go-pear.phar# 将工具目录添加到环境变量中# 编辑/etc/profile 追加一行配置export PATH=$PATH:/home/用户名/pear/bin# 加载环境配置source /etc/profile# 配置工具的php_ini选项,这样安装拓展时pecl工具就能帮我们自动配置php.ini文件了# vim /home/用户名/pear/share/pear/PEAR/Config.php# 搜索php_ini, default键修改为你的php.ini文件路径:        'php_ini' => array(            'type' => 'file',            'default' => '/etc/php.ini',            'doc' => 'location of php.ini in which to enable PECL extensions on install',            'prompt' => 'php.ini location',            'group' => 'File Locations (Advanced)',            ),   #确认一下,配置起效pecl config-get php_ini  #配置成功将显示 /etc/php.ini# 搜索mysql拓展pecl search mysql# 这时一般会提示我们更新工具, 则我们依据提示进行更新sudo pecl channel-update pecl.php.net# 再次搜索mysql拓展, 成功pecl search mysql# 安装拓展pecl install  mysql源码编译安装# 以安装phpredis拓展为例git clone https://github.com/phpredis/phpredis.git  # 下载phpredis源码cd phpredis/phpize./configuremake & make installcp rpm/redis.ini /etc/php.d/redis.ini检查mysql拓展是否安装成功php -i | grep mysql成功安装后上面命令将显示一个节区的mysql拓展状态信息。但拓展加载到运行环境中还需要你重启 web服务 亦或是 php-fpm

根据上面的完全不行,然而,我们打开php -v可以看到:
这里写图片描述

解决方案:

undefined-symbol-php_json_decode_ex-in-unknown-on-line-0-solr-so-in-ubuntu

undefined symbol: php_json_decode_ex in Unknown on line 0 – Solr.so in UbuntuNovember 6, 2014 Make you sure that this line comes before your newly added extension in php.iniextension=json.sothen add your extensionextension=xyz.so

由此可知,可能是插件加载顺序的问题,那么先加载json.so

这里写图片描述

这里写图片描述

看到pdo这个前缀,不如也将pdo.so加到前面去。

这里写图片描述

这里写图片描述

正常运行,不过说已经加载了。。。算了,可以运行就好了。
这里写图片描述

正式配置完毕

后续补充

pg_connect依然无法使用,就是说,还有一个模块pgsql没有配置,根据网上说法:

上周博主在这篇文章中介绍了php采集,http://www.sijitao.net/1511.html。PHP+PostgreSQL的环境配置其实也不顺利。首先我在系统中安装了PostgreSQL数据库,用EnterpriseDB包。然后重新编译PHP,在编译中加入--with-pgsql=路径。可是编译后发现还是没有加载php_pgsql扩展。继续google,我后来也使用过yum install php-pgsql命令安装扩展,但是结果还是一样。不过功夫不负有心人,问题最后终于还是解决了。先从http://rpmfind.net/linux/RPM/index.html这个站点分别下载了“php53-common-5.3.3-21.el5.i386.rpm”、“php53-pdo-5.3.3-21.el5.i386.rpm”和“php53-pgsql-5.3.3-21.el5.i386.rpm”三个安装包,分别安装。安装成功后会在/usr/lib/php/modules/目录下生成pgsql.so等扩展。php_postgresql_1然后在扩展目录下新建pgsql.so和pdo_pgsql.so链接。最后修改配置文件,在扩展中加入pgsql.so,重启php。php_postgresql_2使用phpinfo查看,发现pgsql扩展已经安装成功,贴上成功图。php_postgresql_3

1、找到php common,编译安装:

http://www.rpmfind.net/linux/rpm2html/search.php?query=php-common%28x86-64%29&submit=Search+…&system=&arch=
注意:
我这里使用的是:
这里写图片描述
连接是:
ftp://195.220.108.108/linux/centos/7.3.1611/os/x86_64/Packages/php-common-5.4.16-42.el7.x86_64.rpm

执行:

wget ftp://195.220.108.108/linux/centos/7.3.1611/os/x86_64/Packages/php-common-5.4.16-42.el7.x86_64.rpm

这里写图片描述

当然,你也可以这样子下载下来然后上传到服务器

这里写图片描述

安装

rpm -ivh php-common-5.4.16-42.el7.x86_64.rpm

问题如下:

这里写图片描述

好了,根据百度的结果:
这里写链接内容

这里写图片描述

这里写图片描述

yum install libzip

这里写图片描述

安装完毕。继续:

rpm -ivh php-common-5.4.16-42.el7.x86_64.rpm

这里写图片描述

我这边的同样的库已经装过了,而且版本更新,就不需要安装这个php common了。

原创粉丝点击