How to enable PostgreSQL extension for PHP

9 de agosto, 2016 @ 13:17 — 3 comentariosDownload PDF

Once you have activated the PostgreSQL service and created a new database, you may use PostgreSQL from PHP.

Anyway , you should consider the following points:

  • PHP 5.4 or higher is required: 5.4, 5.5, 5.6, 7.0, ...
  • You need to chose between, PostgeSQL PHP extension and PostgreSQL PDO extension.
  • You need to activate the extension you chose.

How to enable PostgeSQL PHP extension

To enable the PostgeSQL PHP extension you just need to add the following line to the php.ini file of your running PHP version:

extension=pgsql.so

You might do this using our PHP Configuration page inside the Hosting Panel or by editing the php.ini file manualy. Our How to modify PHP Configuration guide can help you.

If you chose to modify it through the Hosting panel, you should add the extension variable as shown:

 

postgresql_php_extension

 

How to enable PostgeSQL PDO extension

To enable the PostgreSQL PDO Extension, you just need to add the following line to the php.ini file of your running PHP version:

extension=pdo_pgsql.so

The process is the same as it is for the PHP extension.