dounieliang4712 2018-03-27 09:57
浏览 67

在MacOS Bash上使用PHP服务器错误的Postgresql数据库

I ran a PHP server with postgresql on my college computers which works fine, however on my local machine (which runs MacOS), I get the following error message:

Call to undefined function pg_Connect() in /Users/mac/Documents/<... the remaining path to php file>.php on line 2

Now, I thought it's an issue of missing the postgresql packages for php, so I used brew to install the php postgresql packages. I ran the following commands:

brew install postgresql
brew install php55 --with-postgresql
brew install php55-pdo-pgsql

However, even after running these commands I get the same error when running the php server, i.e.

Call to undefined function pg_Connect() in /Users/mac/Documents/<... the remaining path to php file>.php on line 2

The php version I have is 5.5.30:

mac$ php -v
PHP 5.5.30 (cli) (built: Oct 23 2015 17:21:45) 
Copyright (c) 1997-2015 The PHP Group
Zend Engine v2.5.0, Copyright (c) 1998-2015 Zend Technologies

Please could you suggest what I am doing wrong to install the packages. I read on stack overflow that the packages can be installed with an apt-get command on linux, however I'm not sure as to what the solution is with the Mac operating system.

Thanks in advance.

  • 写回答

1条回答 默认 最新

  • douchi2022 2018-03-27 10:00
    关注

    The solution was edit the php.ini on your server then find this below line and uncomment that line.

    extension="pgsql.so"
    

    then restart the server apache and test it out again.

    Also, check this link for the steps regarding installation of the postgress to mac OS.

    评论

报告相同问题?

悬赏问题

  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 对于相关问题的求解与代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 信号傅里叶变换在matlab上遇到的小问题请求帮助
  • ¥15 保护模式-系统加载-段寄存器
  • ¥15 电脑桌面设定一个区域禁止鼠标操作
  • ¥15 求NPF226060磁芯的详细资料