I have the following DDEV config file:
name: whatever
type: php
docroot: public
php_version: "8.3"
webserver_type: nginx-fpm
database:
type: postgres
version: "15"
dbimage_extra_packages: [postgis]
But when I try to enable the extension, it says that postgis is not installed in the container.
The official ddev docs don't mention anything about this, so I wonder if anyone on Stackoverflow can shed some light on the matter.
This is how I am trying to enable the extension:
ddev ssh -s db
psql
CREATE EXTENSION postgis;
And this is what I get:
db=# CREATE EXTENSION postgis;
ERROR: extension "postgis" is not available
DETAIL: Could not open extension control file "/usr/share/postgresql/15/extension/postgis.control": No such file or directory.
Thanks.
Use the appropriate installation instructions for your version of PostgreSQL:
(ARM64 packages may not work for PostgreSQL 9,10,11.)
ddev config --dbimage-extra-packages=postgresql-17-postgis-3,postgresql-17-postgis-3-scripts,postgis
ddev config --dbimage-extra-packages=postgresql-16-postgis-3,postgresql-16-postgis-3-scripts,postgis
ddev config --dbimage-extra-packages=postgresql-15-postgis-3,postgresql-15-postgis-3-scripts,postgis
ddev config --dbimage-extra-packages=postgresql-14-postgis-3,postgresql-14-postgis-3-scripts,postgis
ddev config --dbimage-extra-packages=postgresql-13-postgis-3,postgresql-13-postgis-3-scripts,postgis
ddev config --dbimage-extra-packages=postgresql-12-postgis-3,postgresql-12-postgis-3-scripts,postgis
ddev config --dbimage-extra-packages=postgresql-11-postgis-2.5,postgresql-11-postgis-2.5-scripts,postgis
ddev config --dbimage-extra-packages=postgresql-10-postgis-2.4,postgresql-10-postgis-2.4-scripts,postgis
ddev config --dbimage-extra-packages=postgresql-9.6-postgis-2.3,postgresql-9.6-postgis-scripts,postgis
It is better not to install from metapackages like postgresql-postgis and postgresql-postgis-scripts, as the base version of PostgreSQL changes with each Debian release (for example, Debian Bookworm uses PostgreSQL 15):
# do not use this
ddev config --dbimage-extra-packages=postgresql-postgis,postgresql-postgis-scripts,postgis