Yesterday, I wanted to use PHP code to read all the data table information from a local PostgreSQL database, and when I joined the database, there was an error fatal Error:call to undefined function pg_connect (). The extension to Pgsql was not turned on. So I removed the semicolon before the ' Extension=php_pgsql.dll ' in php.ini, but the problem still remained unresolved. Tried this afternoon to run a connection PostgreSQL PHP code in the CLI, and the result passed. Suspected of being used in php.ini and servers used in the CLI. PHP.ini inconsistent results, so look at it, they are not the same php.ini configuration file, but the contents of the two files are identical, and the PHP version number is the same, are PHP5.3.6, this is strange. Google, Baidu has many times, looked at almost all the relevant issues of the Web page, tried a variety of methods (including copy DLL to C disk system directory, add environment variables, etc., in addition to a PHP version), eventually failed to solve the problem. is ready to change a PHP version of the former, suddenly thought of Baidu Encyclopedia to see the PHP PostgreSQL, MySQL and other databases, the result unexpectedly in the PHP installation of the problem saw the reason: did not copy pgsql dll to the system32 directory, Causes PHP to not recognize these functions such as pg_connect. So, the ./php/libpq.dll(Libpq.dll under the PHP folder) and the ./php/ext/php_pgsql.dll(The PHP_ under the Ext folder) Pgsql.dll) These two DLL files are copied to the C disk System32 and then viewed Phpinfo () and found that the module pgsql appears in the list. Then, the table information in the database was successfully read. |