简体   繁体   中英

Connect to postgreSQL db using PHP on mac os X

I tried to connect to a local postgre Database with PDO using PHP.

  1. When running my code, the error message showed: Fatal error: Uncaught PDOException: could not find driver in {file path}

  2. After googling, it looks like updating the PDO extension is a way fixing it.

    Then I tried to use the code here .

  3. When executing line 21 ./configure --with-pdo-pgsql="/Library/PostgreSQL/9.3/"
    , the error message is shown: configure: error: Cannot find libpq-fe.h. Please specify correct PostgreSQL installation path configure: error: Cannot find libpq-fe.h. Please specify correct PostgreSQL installation path
    ps I check the setting of my Postgres, the paths are shown below, do I need to change path to one of those?

环境

  1. Then I googled for the error again. There are a number of post indicate that using yum -y install postgresql-devel

  2. But the error shows again when I tried to run the code: -bash: yum: command not found

This is a confusing journey of PHP beginner tried to figure out getting data from a database using

PHP. Can someone provide a way to do achieve this (On Mac)?

The problem is solved when changing my local server from xampp to mapp.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM