PHP support for Postgresql

Hi, I´m trying to include PHP support for Postgresql.

I´m using the image created by this Toradex tutorial:

Can somebody help me with this?

PHP recipe in OpenEmbedded does not seem to enable support for Postgres by default. It needs to be enabled explicitly. The correct procedure to enable it would be to have a layer for your own project and use a php_5.5.21.bbappend file and then use PACKAGECONFIG_append = " pqsql" for enabling Postgres support for PHP. You may find this article helpful.

Alternatively one may add

--with-pgsql=${STAGING_DIR_TARGET}${exec_prefix} \

this to the EXTRA_OECONF variable in that file as can be seen here.

Hi Sanchayan,
My EXTRA_OECONF variable is already with that config you said plus this ones:

 PACKAGECONFIG[pgsql] = "--with-pgsql=${STAGING_DIR_TARGET}${exec_prefix} \
    			--with-pdo-pgsql=${STAGING_BINDIR_CROSS}/pg_config \
    			,--without-pgsql --without-pdo-pgsql \
    			,postgresql"

But, when I run a phpinfo() test page, I don´t see any pgsql or pdosql as you can see in the attachment.

Any advise is welcome.

My Configure Command:
‘/build/jenkins/angstrom-v2014.12/machine/beagleboard/build/tmp-angstrom_v2014_12-glibc/work/armv7at2hf-vfp-neon-angstrom-linux-gnueabi/php/5.4.36-r0/php-5.4.36/configure’ ‘–build=x86_64-linux’ ‘–host=arm-angstrom-linux-gnueabi’ ‘–target=arm-angstrom-linux-gnueabi’ ‘–prefix=/usr’ ‘–exec_prefix=/usr’ ‘–bindir=/usr/bin’ ‘–sbindir=/usr/sbin’ ‘–libexecdir=/usr/lib/php’ ‘–datadir=/usr/share’ ‘–sysconfdir=/etc’ ‘–sharedstatedir=/com’ ‘–localstatedir=/var’ ‘–libdir=/usr/lib’ ‘–includedir=/usr/include’ ‘–oldincludedir=/usr/include’ ‘–infodir=/usr/share/info’ ‘–mandir=/usr/share/man’ ‘–disable-silent-rules’ ‘–disable-dependency-tracking’ ‘–with-libtool-sysroot=/build/jenkins/angstrom-v2014.12/machine/beagleboard/build/tmp-angstrom_v2014_12-glibc/sysroots/beagleboard’ ‘–enable-mbstring’ ‘–enable-wddx’ ‘–enable-fpm’ ‘–with-imap=/build/jenkins/angstrom-v2014.12/machine/beagleboard/build/tmp-angstrom_v2014_12-glibc/sysroots/beagleboard’ ‘–with-gettext=/build/jenkins/angstrom-v2014.12/machine/beagleboard/build/tmp-angstrom_v2014_12-glibc/sysroots/beagleboard/usr/lib/…’ ‘–with-imap-ssl=/build/jenkins/angstrom-v2014.12/machine/beagleboard/build/tmp-angstrom_v2014_12-glibc/sysroots/beagleboard’ ‘–with-zlib=/build/jenkins/angstrom-v2014.12/machine/beagleboard/build/tmp-angstrom_v2014_12-glibc/sysroots/beagleboard/usr/lib/…’ ‘–with-iconv=/build/jenkins/angstrom-v2014.12/machine/beagleboard/build/tmp-angstrom_v2014_12-glibc/sysroots/beagleboard/usr/lib/…’ ‘–enable-sockets’ ‘–enable-pcntl’ ‘–enable-shared’ ‘–enable-nls’ ‘–with-mysql=/build/jenkins/angstrom-v2014.12/machine/beagleboard/build/tmp-angstrom_v2014_12-glibc/sysroots/beagleboard/usr’ ‘–with-mysqli=/build/jenkins/angstrom-v2014.12/machine/beagleboard/build/tmp-angstrom_v2014_12-glibc/sysroots/beagleboard/usr/bin/crossscripts/mysql_config’ ‘–with-pdo-mysql=/build/jenkins/angstrom-v2014.12/machine/beagleboard/build/tmp-angstrom_v2014_12-glibc/sysroots/beagleboard/usr/bin/crossscripts/mysql_config’ ‘–with-sqlite3=/build/jenkins/angstrom-v2014.12/machine/beagleboard/build/tmp-angstrom_v2014_12-glibc/sysroots/beagleboard/usr/lib/…’ '–with-pdo-sqlite=/build/jenkins/angstrom-v2014.12/machine/beagleboard/build/tmp-angstrom_v2014_12-glibc/sysroots/beagleboard/usr/lib/…

Why do your logs show Beagleboard? Are you using our OpenEmbedded tree?

The PACKAGECONFIG exists but one needs to add the relevant config option to EXTRA_OECONF. Can you enter the directory ~oe-core/stuff/meta-openembedded and share the git diff?

diff --git a/meta-oe/recipes-devtools/php/php.inc b/meta-oe/recipes-devtools/php/php.inc
index 67d2362..13d0020 100644
--- a/meta-oe/recipes-devtools/php/php.inc
+++ b/meta-oe/recipes-devtools/php/php.inc
@@ -53,6 +53,7 @@ EXTRA_OECONF = "--enable-mbstring \
                 --enable-wddx \
                 --enable-fpm \
                 --enable-zip \
+               --with-pgsql=${STAGING_DIR_TARGET}${exec_prefix} \
                 --with-libdir=${baselib} \
                 --with-gettext=${STAGING_LIBDIR}/.. \
                 --with-zlib=${STAGING_LIBDIR}/.. \

The above is from Jethro branch from me, for you it should be something similar and in the php_5.4.36.bb file since in dizzy branch which you use, the bitbake recipe file is used directly. I would recommend updating to latest jethro. In original post, you mention 2015.06 which is fido branch but your logs show 2014.12 dizzy branch.

Using lighttpd as server, enabling FastCGI support and then checking for phpinfo shows the below for it’s configuration option.

'/build/mas/oe-jethro/build/out-glibc/work/armv7ahf-vfp-neon-angstrom-linux-gnueabi/php/5.6.12-r0/php-5.6.12/configure' '--build=x86_64-linux' '--host=arm-angstrom-linux-gnueabi' '--target=arm-angstrom-linux-gnueabi' '--prefix=/usr' '--exec_prefix=/usr' '--bindir=/usr/bin' '--sbindir=/usr/sbin' '--libexecdir=/usr/lib/php' '--datadir=/usr/share' '--sysconfdir=/etc' '--sharedstatedir=/com' '--localstatedir=/var' '--libdir=/usr/lib' '--includedir=/usr/include' '--oldincludedir=/usr/include' '--infodir=/usr/share/info' '--mandir=/usr/share/man' '--disable-silent-rules' '--disable-dependency-tracking' '--with-libtool-sysroot=/build/mas/oe-jethro/build/out-glibc/sysroots/apalis-t30' '--enable-mbstring' '--enable-wddx' '--enable-fpm' '--enable-zip' '--with-pgsql=/build/mas/oe-jethro/build/out-glibc/sysroots/apalis-t30/usr' '--with-libdir=lib' '--with-gettext=/build/mas/oe-jethro/build/out-glibc/sysroots/apalis-t30/usr/lib/..' '--with-zlib=/build/mas/oe-jethro/build/out-glibc/sysroots/apalis-t30/usr/lib/..' '--with-iconv=/build/mas/oe-jethro/build/out-glibc/sysroots/apalis-t30/usr/lib/..' '--with-mcrypt=/build/mas/oe-jethro/build/out-glibc/sysroots/apalis-t30/usr' '--with-bz2=/build/mas/oe-jethro/build/out-glibc/sysroots/apalis-t30/usr' '--with-config-file-path=/etc/php/apache2-php5' 'ac_cv_c_bigendian_php=no' '--enable-sockets' '--enable-pcntl' '--enable-shared' '--disable-opcache' '--disable-rpath' '--with-pic' '--libdir=/usr/lib/php5' '--enable-nls' '--with-imap=/build/mas/oe-jethro/build/out-glibc/sysroots/apalis-t30' '--with-imap-ssl=/build/mas/oe-jethro/build/out-glibc/sysroots/apalis-t30' '--with-mysql=/build/mas/oe-jethro/build/out-glibc/sysroots/apalis-t30/usr' '--with-mysqli=/build/mas/oe-jethro/build/out-glibc/sysroots/apalis-t30/usr/bin/crossscripts/mysql_config' '--with-pdo-mysql=/build/mas/oe-jethro/build/out-glibc/sysroots/apalis-t30/usr/bin/crossscripts/mysql_config' '--without-pgsql' '--disable-soap' '--with-sqlite3=/build/mas/oe-jethro/build/out-glibc/sysroots/apalis-t30/usr/lib/..' '--with-pdo-sqlite=/build/mas/oe-jethro/build/out-glibc/sysroots/apalis-t30/usr/lib/..' 'build_alias=x86_64-linux' 'host_alias=arm-angstrom-linux-gnueabi' 'target_alias=arm-angstrom-linux-gnueabi' 'CC=arm-angstrom-linux-gnueabi-gcc '-march=armv7-a' '-marm' '-mthumb-interwork' '-mfloat-abi=hard' '-mfpu=neon' '--sysroot=/build/mas/oe-jethro/build/out-glibc/sysroots/apalis-t30'' 'CFLAGS= '-O2' '-pipe' '-g' '-feliminate-unused-debug-types' '-D_GNU_SOURCE' '-g' '-DPTYS_ARE_GETPT' '-DPTYS_ARE_SEARCHED' '-I/build/mas/oe-jethro/build/out-glibc/sysroots/apalis-t30/usr/include/apache2'' 'LDFLAGS=-Wl,-O1 '-Wl,--hash-style=gnu' '-Wl,--as-needed'' 'CPPFLAGS=' 'CPP=arm-angstrom-linux-gnueabi-gcc '-E' '--sysroot=/build/mas/oe-jethro/build/out-glibc/sysroots/apalis-t30' '-march=armv7-a' '-marm' '-mthumb-interwork' '-mfloat-abi=hard' '-mfpu=neon'' 'PKG_CONFIG_PATH=/build/mas/oe-jethro/build/out-glibc/sysroots/apalis-t30/usr/lib/pkgconfig:/build/mas/oe-jethro/build/out-glibc/sysroots/apalis-t30/usr/share/pkgconfig' 'PKG_CONFIG_LIBDIR=/build/mas/oe-jethro/build/out-glibc/sysroots/apalis-t30/usr/lib/pkgconfig' 'CXX=arm-angstrom-linux-gnueabi-g++ '-march=armv7-a' '-marm' '-mthumb-interwork' '-mfloat-abi=hard' '-mfpu=neon' '--sysroot=/build/mas/oe-jethro/build/out-glibc/sysroots/apalis-t30'' 'CXXFLAGS= '-O2' '-pipe' '-g' '-feliminate-unused-debug-types' '-fvisibility-inlines-hidden''

I don´t have a clue why is it showing beagleboard. I just used Toradex tutorial with version 2.5, angstrom v2015.06, fido,1.8 .

Diff command returns error:
diff: unrecognized option ‘–git’

I tried git diff but got another error:
fatal: ambiguous argument ‘a/meta-oe/recipes-devtools/php/php.inc’: unknown revision or path not in the working tree.
Use ‘–’ to separate paths from revisions, like this:
‘git […] – […]’

I’m updating to HEAD version now to see if something changes.

I used:
repo init -b LinuxImageV2.6
repo sync

Now, when I make

bitbake console-trdx-image

Got this error:

ERROR: ParseError at /home/fabatera/oe-core/build/…/stuff/meta-angstrom/recipes-images/angstrom/systemd-qt5-image.bb:5: Could not inherit file classes/populate_sdk_qt5.bbclass

Can you remove the older OE core install and start from scratch? To check for a diff in a source tree with git as VCS, all that is required is

git diff

Too many errors occurring using previous install. I will start from scratch and post results later for you.

Thanks for your help!

@Fabiano.Ferronato try as:

bitbake core-image-minimal

Thanks Cleiton, I’ll try core-image-minimal later.

Hi Sanchayan,

I built everything from scratch. ( Toradex Version 2.6, Angstrom v2015.12 jethro, yocto 2.0). Still no php support for postgresql.This is my phpinfo

diff --git a/meta-oe/recipes-devtools/php/php.inc b/meta-oe/recipes-devtools/php/php.inc
index 67d2362..57a828a 100644
--- a/meta-oe/recipes-devtools/php/php.inc
+++ b/meta-oe/recipes-devtools/php/php.inc
@@ -53,6 +53,7 @@ EXTRA_OECONF = "--enable-mbstring \
                 --enable-wddx \
                 --enable-fpm \
                 --enable-zip \
+                --with-pgsql=${STAGING_DIR_TARGET}${exec_prefix} \
                 --with-libdir=${baselib} \
                 --with-gettext=${STAGING_LIBDIR}/.. \
                 --with-zlib=${STAGING_LIBDIR}/.. \

Thanks!

Finally I found the problem:

I was updating the board with new linux image but php-cgi was not installed by default. I was making

opkg update
opkg install php-cgi

Then I saw phpinfo Build Date was wrong.

I copied php-cgi from my pc build and installed on the board and now I can see

--with-pgsql= .... 

Now I think I have to configure php driver to access postgress databese (pdo-pgsql). Right?

Maybe something like this:

PACKAGECONFIG[pgsql] = "--with-pgsql=${STAGING_DIR_TARGET}${exec_prefix} \
                        --with-pdo-pgsql=${STAGING_LIBDIR}/.. \
                       ,--without-pgsql --without-pdo-pgsql \
                       ,postgresql"

or

PACKAGECONFIG[pgsql] = "--with-pgsql=${STAGING_DIR_TARGET}${exec_prefix} \
                        --with-pdo-pgsql=${STAGING_LIBDIR}/postgresql/.. \
                       ,--without-pgsql --without-pdo-pgsql \
                       ,postgresql"

Hey @Fabiano.Ferronato greetings from my side

about above solution can you please elaborate more way as I got error during bitbake of php_pgsql

please share your thoughts for the same ans can you please share the above step more elaborated.

Hi @smit@masibus.com and Welcome to the Toradex Community!

To keep the community clean and well organized, could you post a new question with all the information to reproduce the issue and provide any textual error log?

Thanks and best regards,
Jaski