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.

    评论

报告相同问题?

悬赏问题

  • ¥15 高价求中通快递查询接口
  • ¥15 解决一个加好友限制问题 或者有好的方案
  • ¥15 关于#java#的问题,请各位专家解答!
  • ¥15 急matlab编程仿真二阶震荡系统
  • ¥20 TEC-9的数据通路实验
  • ¥15 ue5 .3之前好好的现在只要是激活关卡就会崩溃
  • ¥50 MATLAB实现圆柱体容器内球形颗粒堆积
  • ¥15 python如何将动态的多个子列表,拼接后进行集合的交集
  • ¥20 vitis-ai量化基于pytorch框架下的yolov5模型
  • ¥15 如何实现H5在QQ平台上的二次分享卡片效果?