Php configure Unable to build the PostgreSQL extension - php

I'm trying to intall/configure php-8.2.2 on rhel8.7.
This is my configure string:
./configure --prefix=/usr/www/php-8.2.2 --with-apxs2=/usr/www/httpd/bin/apxs --with-expat --with-openssl=/usr/www/openssl --with-zlib-dir=/usr/www/zlib --with-curl=/usr/www/curl --enable-soap --enable-sockets --with-pgsql=/usr/postgres --enable-sysvmsg --enable-sysvsem --enable-sysvshm --enable-mbstring --without-pear --with-external-pcre
During installation I receive this error:
checking whether to enable pcntl support... no
checking whether to enable PDO support... yes
checking for PDO_DBLIB support via FreeTDS... no
checking for Firebird support for PDO... no
checking for MySQL support for PDO... no
checking for the location of libz... /usr/www/zlib
checking Oracle OCI support for PDO... no
checking for ODBC v3 support for PDO... no
checking for PostgreSQL support for PDO... no
checking for sqlite 3 support for PDO... yes
checking for PDO includes... /home/lmwusr/terna/php-8.1.15/ext
checking for sqlite3 >= 3.7.7... yes
checking for sqlite3_close_v2 in -lsqlite3... yes
checking for sqlite3_column_table_name in -lsqlite3... yes
checking for PostgreSQL support... yes
checking for pg_config... /usr/postgres/bin/pg_config
checking for PQlibVersion in -lpq... no
configure: error: Unable to build the PostgreSQL extension: at least libpq 9.1 is required
Postgres 13 is installed and it works. If I run the same configuration with php 7.2, it works fine, same problem also php-8.1.15 and php-8.0.0
This is my environment:
export PKG_CONFIG_PATH=/usr/www/libxml2/lib/pkgconfig:/usr/www/openssl/lib/pkgconfig:/usr/www/curl/lib/pkgconfig::/usr/www/onig/lib/pkgconfig:/usr/postgres/lib/pkgconfig:/usr/www/pcre2/lib/pkgconfig
export LD_LIBRARY_PATH=/usr/postgres/lib
What I can to do/try, for compile php-8.2.2?
Thanks a lot

Related

ldap error message when compiling PHP 7.4 on Red Hat 8

I'm testing RH8. I'm trying to compile PHP 7.4.19 with the following configuration command. (I have dnf/yum the necessary libraries before):
./configure --prefix=/usr/local/php --with-apxs2=/usr/local/apache2/bin/apxs --with-openssl --with-zip --with-jpeg=/usr/lib --enable-gd --enable-exif --enable-mbstring --with-ldap --with-pdo-mysql --enable-intl --enable-soap --with-mysqli
The configure process works fine, with no errors. This is what it shows up related to ldap:
checking for LDAP support... yes
checking whether to build with LDAP Cyrus SASL support... no
checking size of long... (cached) 8
checking if we're at 64-bit platform... yes
checking for 3 arg ldap_set_rebind_proc... yes
checking for ldap_parse_result... yes
checking for ldap_parse_reference... yes
checking for ldap_start_tls_s... yes
checking for ldap_control_find... yes
checking for ldap_parse_extended_result... yes
checking for ldap_extended_operation... yes
checking for ldap_extended_operation_s... yes
checking for ldap_passwd... yes
checking for ldap_whoami_s... yes
checking for ldap_refresh_s... yes
checking for ldap_bind_s... yes
But then, when I run "make" I got the following error.
/usr/bin/ld: ext/ldap/.libs/ldap.o: undefined reference to symbol 'ber_memfree'
//usr/lib64/liblber-2.4.so.2: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
make: *** [Makefile:278: sapi/cli/php] Error 1
Have you ever had this problem before? I haven't been able to find anything on the Internet about this error.
Any suggestion would be more than welcome. I did the same test with php 7.4.16 and I got the same error.
Thanks.
I have been able to fix this issue by adding the following symbolic link:
ln -s /usr/lib64/liblber.so /usr/lib/liblber.so
I hope this solution might be useful

Adding GMP PHP extension to MAMP

Trying to use MAMP 3.4 with the latest version of PHP currently on there (5.6.10) but I need the PHP extension GMP. My understanding is that that extension is not a separate module but requires a complete re-compile of PHP with --with-gmp.
Trying to follow the guide linked here with clean 5.6.10 source code but I get the same error the OP is having:
Didiers-MacBook-Pro:php-5.6.10 didier$ ./configure --with-mysql=/Applications/MAMP/Library --with-apxs2=/Applications/MAMP/Library/bin/apxs --with-gd --with-jpeg-dir=/Applications/MAMP/Library --with-png-dir=/Applications/MAMP/Library --with-zlib --with-freetype-dir=/Applications/MAMP/Library --prefix=/Applications/MAMP/bin/php5 --exec-prefix=/Applications/MAMP/bin/php5 --sysconfdir=/Applications/MAMP/conf/php5 --with-soap --with-config-file-path=/Applications/MAMP/conf/php5 --enable-track-vars --enable-bcmath --enable-ftp --enable-gd-native-ttf --with-bz2=/usr --with-ldap --with-mysqli=/Applications/MAMP/Library/bin/mysql_config --with-sqlite --with-ttf --with-t1lib=/Applications/MAMP/Library --enable-mbstring=all --with-curl=/Applications/MAMP/Library --enable-dbx --enable-sockets --enable-bcmath --with-imap=shared,/Applications/MAMP/Library/lib/imap-2006i --enable-soap --with-kerberos --enable-calendar --with-pgsql=shared,/Applications/MAMP/Library/pg --enable-dbase --enable-exif --with-libxml-dir=/Applications/MAMP/Library --with-gettext=shared,/Applications/MAMP/Library --with-xsl=/Applications/MAMP/Library --with-pdo-mysql=/Applications/MAMP/Library --with-pdo-pgsql=shared,/Applications/MAMP/Library/pg --with-mcrypt=shared,/Applications/MAMP/Library --with-openssl --with-gmp --without-iconv --prefix=/Users/Didier/Desktop/result
configure: WARNING: unrecognized options: --with-soap, --enable-track-vars, --with-sqlite, --with-ttf, --enable-dbx, --enable-dbase
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking for a sed that does not truncate output... /usr/bin/sed
checking build system type... x86_64-apple-darwin14.5.0
checking host system type... x86_64-apple-darwin14.5.0
checking target system type... x86_64-apple-darwin14.5.0
checking for cc... cc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether cc accepts -g... yes
checking for cc option to accept ISO C89... none needed
checking how to run the C preprocessor... cc -E
checking for icc... no
checking for suncc... no
checking whether cc understands -c and -o together... yes
checking how to run the C preprocessor... cc -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking minix/config.h usability... no
checking minix/config.h presence... no
checking for minix/config.h... no
checking whether it is safe to define __EXTENSIONS__... yes
checking whether ln -s works... yes
checking for system library directory... lib
checking whether to enable runpaths... yes
checking if compiler supports -R... no
checking if compiler supports -Wl,-rpath,... yes
checking for gawk... no
checking for nawk... no
checking for awk... awk
checking if awk is broken... no
checking for bison... bison -y
checking for bison version... invalid
configure: WARNING: This bison version is not supported for regeneration of the Zend/PHP parsers (found: 2.3, min: 204, excluded: 3.0).
checking for re2c... no
configure: WARNING: You will need re2c 0.13.4 or later if you want to regenerate PHP parsers.
checking whether to enable computed goto gcc extension with re2c... no
checking whether cc supports -no-cpp-precomp... yes
checking whether to force non-PIC code in shared modules... no
checking whether /dev/urandom exists... yes
checking for pthreads_cflags...
checking for pthreads_lib...
Configuring SAPI modules
checking for AOLserver support... no
checking for Apache 1.x module support via DSO through APXS... no
checking for Apache 1.x module support... no
checking whether to enable Apache charset compatibility option... no
checking for Apache 2.0 filter-module support via DSO through APXS... no
checking for Apache 2.0 handler-module support via DSO through APXS...
Sorry, I cannot run apxs. Possible reasons follow:
1. Perl is not installed
2. apxs was not found. Try to pass the path using --with-apxs2=/path/to/apxs
3. Apache was not built using --enable-so (the apxs usage page is displayed)
The output of /Applications/MAMP/Library/bin/apxs follows:
cannot open /Applications/MAMP/Library/build/config_vars.mk: No such file or directory at /Applications/MAMP/Library/bin/apxs line 217.
configure: error: Aborting
Turns out that you need some critical files from httpd in order to build php as a Apache modules (as MAMP requires). MAMP ommits those files from the install.
Download Apache from http://mirror.reverse.net/pub/apache/httpd/
Make sure that the version you're downloading is the same one found in the MAMP distribution. You can type /Applications/MAMP/Library/bin/httpd -version from the command line in order to find out.
Un-tar the distribution and cd into it.
Make a folder somewhere to store the build results. We'll put our files on the desktop, in something like ~/Desktop/build/httpd.
Next step is to build httpd. Something like ./configure --prefix=/Users/[username]/Desktop/build/httpd --enable-so should do the trick. Note the the install path needs to be absolute so we can't use the tilde character here.
Once configuration is finished and without any errors, make and then make install. You now have a Apache server compiled from source. Congrats!
From that build, we need to grab the files missing from our MAMP install. This is actually a single directory located at ~/Desktop/build/httpd/build. Copy this into /Applications/MAMP/Library and you will now be able to build PHP without that aforementioned error message. Make sure that you copy the directory and don't move it. You will need it later during the PHP compilation.
Next step is to compile PHP itself:
Download the PHP source from http://php.net/downloads.php.
Make sure that you are downloading the same version that you're trying to replace (you can find all the versions MAMP has in store in /Applications/MAMP/bin/php. In my case I'm building 5.6.10.
Un-tar the distribution and cd into it.
Make a folder somewhere to store the build results. Once again, I'm putting my results on my desktop in ~/Desktop/build/php.
Configure PHP to build what you need with something like ./configure --with-apxs2=/Applications/MAMP/Library/bin/apxs --prefix=/Users/[username]/Desktop/build/php --with-openssl --without-iconv. If you want you can look at the existing phpinfo page for the version you're replacing to find out what it was compiled with. Keep in mind that some modules will require you to have built from source copies of some other libraries.
make and make install.
You now have a shared object for php that you can use with MAMP. Close MAMP, copy ~/Dekstop/build/httpd/modules/libphp5.so into /Applications/MAMP/bin/php/php5.6.10/modules and restart it. Keeping a copy of the previous libphp5.so file is not a bad idea just in case things go south.

Updating MAMP to PHP 5.4.8

I used this guide How do you upgrade MAMP's PHP to PHP 5.3 ? to update my PHP-Version on MAMP but it does not work.
I'm not sure if I did everything right.
I downloaded php 5.4.8 und put the folder into MAMP -> conf and renamed it to php5.4.8 to make it even with the other PHP Folders in there. Than I followed the guide, but got the following error:
Binarys-MacBook-Air:~ BinaryCoder$ cd /Applications/MAMP/conf/php5.4.8
Binarys-MacBook-Air:php5.4.8 BinaryCoder$ ./configure --with-mysql=/Applications/MAMP/Library --with-apxs2=/Applications/MAMP/Library/bin/apxs --with-gd --with-jpeg-dir=/Applications/MAMP/Library --with-png-dir=/Applications/MAMP/Library --with-zlib --with-freetype-dir=/Applications/MAMP/Library --prefix=/Applications/MAMP/bin/php/php5.4.4 --exec-prefix=/Applications/MAMP/bin/php/php5.4.4 --sysconfdir=/Applications/MAMP/bin/php/php5.4.4/conf --with-config-file-path=/Applications/MAMP/bin/php/php5.4.4/conf --enable-ftp --enable-gd-native-ttf --with-bz2=/usr --with-ldap --with-mysqli=/Applications/MAMP/Library/bin/mysql_config --with-t1lib=/Applications/MAMP/Library --enable-mbstring=all --with-curl=/Applications/MAMP/Library --enable-sockets --enable-bcmath --with-imap=shared,/Applications/MAMP/Library/lib/imap-2007f --enable-soap --with-kerberos --enable-calendar --with-pgsql=shared,/Applications/MAMP/Library/pg --enable-exif --with-libxml-dir=/Applications/MAMP/Library --with-gettext=shared,/Applications/MAMP/Library --with-xsl=/Applications/MAMP/Library --with-pdo-mysql=/Applications/MAMP/Library --with-pdo-pgsql=shared,/Applications/MAMP/Library/pg --with-mcrypt=shared,/Applications/MAMP/Library --with-openssl --enable-zip --with-iconv=/Applications/MAMP/Library --without-iconv
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking for a sed that does not truncate output... /usr/bin/sed
checking build system type... i386-apple-darwin12.2.0
checking host system type... i386-apple-darwin12.2.0
checking target system type... i386-apple-darwin12.2.0
checking for cc... cc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether cc accepts -g... yes
checking for cc option to accept ISO C89... none needed
checking how to run the C preprocessor... cc -E
checking for icc... no
checking for suncc... no
checking whether cc understands -c and -o together... yes
checking how to run the C preprocessor... cc -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking minix/config.h usability... no
checking minix/config.h presence... no
checking for minix/config.h... no
checking whether it is safe to define __EXTENSIONS__... yes
checking whether ln -s works... yes
checking for system library directory... lib
checking whether to enable runpaths... yes
checking if compiler supports -R... no
checking if compiler supports -Wl,-rpath,... yes
checking for gawk... no
checking for nawk... no
checking for awk... awk
checking if awk is broken... no
checking for bison... bison -y
checking for bison version... 2.3 (ok)
checking for re2c... no
configure: WARNING: You will need re2c 0.13.4 or later if you want to regenerate PHP parsers.
checking whether to enable computed goto gcc extension with re2c... no
checking whether cc supports -no-cpp-precomp... yes
checking whether to force non-PIC code in shared modules... no
checking whether /dev/urandom exists... yes
checking for pthreads_cflags...
checking for pthreads_lib...
Configuring SAPI modules
checking for AOLserver support... no
checking for Apache 1.x module support via DSO through APXS... no
checking for Apache 1.x module support... no
checking whether to enable Apache charset compatibility option... no
checking for Apache 2.0 filter-module support via DSO through APXS... no
checking for Apache 2.0 handler-module support via DSO through APXS...
Sorry, I cannot run apxs. Possible reasons follow:
1. Perl is not installed
2. apxs was not found. Try to pass the path using --with-apxs2=/path/to/apxs
3. Apache was not built using --enable-so (the apxs usage page is displayed)
The output of /Applications/MAMP/Library/bin/apxs follows:
cannot open /Applications/MAMP/Library/build/config_vars.mk: No such file or directory at /Applications/MAMP/Library/bin/apxs line 217.
configure: error: Aborting
Binarys-MacBook-Air:php5.4.8 BinaryCoder$
What was my misstake?
Thank you!
MAMP only supports the following
Programs and libraries:
Apache HTTP Server 2.2.22
PHP 5.2.17
PHP 5.3.14 (MAMP PRO only)
PHP 5.4.4
MySQL 5.5.25
phpMyAdmin 3.5.1
SQLiteManager 1.2.4
Alternative PHP Cache (APC) 3.1.9
curl 7.24.0
eAccelerator 0.9.6.1
Expat XML Parser 2.0.1
FreeType 2.4.8
gettext 0.18.1.1
jpeg 8d
libiconv 1.14
Libidn 1.17
libmcrypt 2.6.8
libpng 1.5.7
libxml2 2.7.8
libxslt 1.1.26
Sablotron XML processor 1.0.3
t1lib 5.1.2
XCache 1.2.2
XCache 1.3.2
Xdebug 2.2.0
PHP/YAZ 1.0.14
YAZ 4.0.1
This update is already available on download page, here php 5.4.8 is not available

Compile pdo and pdo_mysql for PHP

I am trying to compile pdo.so and pdo_mysql.so to get pdo support on my PHP5 install.
I tried the following :
./configure --prefix=/thedirectory --with-mysql --with-pdo-mysql --enable-pdo
Compilation is successful but the .so aren't generated.
I am supposed to have/specify a mysql installation?
Is the pdo support supposed to be compiled within php core ?
If I run a php -m I can see PDO and pdo_mysql registered, but a phpinfo() states no pdo_mysql support.
I guess the php -m just tells me php has pdo support but still need the .so?
Could anyone advise?
Thanks
Use the following configure options:
./configure \
--with-mysqli=/home/user/programs/mysql/install/bin/mysql_config \
--with-pdo-mysql=/home/user/programs/mysql/install
The /home/user/programs/mysql/install directory is where MySQL has been installed.
You should see a pdo_mysql section in the phpinfo() output showing the following:
PDO Driver for MySQL enabled
Client API version 5.7.16
The latest versions of PHP come with PDO drivers for MySQL, Oracle, PgSQL, ODBC, SQLite and Firebird/Interbase. All you have to do is enable them in your php.ini:
;extension=php_pdo_firebird.dll
extension=php_pdo_mysql.dll
;extension=php_pdo_oci.dll
;extension=php_pdo_odbc.dll
extension=php_pdo_pgsql.dll
;extension=php_pdo_sqlite.dll
Here I have MySQL, and PgSQL enabled while all others are disabled.
(This is from a php.ini file from Windows, but on linux it looks pretty much the same, just the extensions are in the form of pdo_mysql.so, pdo_pgsql.so, etc.)

eaccelerator 0.9.6.1 and --with-eaccelerator-shared-memory doesn't work

I tried to compile eaccelerator 0.9.6.1 with --with-eaccelerator-shared-memory flag but after:
./configure --with-eaccelerator-shared-memory
got this message:
configure: WARNING: unrecognized options: --with-eaccelerator-shared-memory
I need content cache enabled, so get_ and set_ functions
The user cache functions were removed in 0.9.6 and therefore also the switch with-eaccelerator-shared-memory.
https://eaccelerator.net/wiki/Release-0.9.6
Older versions won't compile with PHP 5.3.
Did you run phpize first to get php version? I just ran configure --with-eaccelerator-shared-memory on my box and I get this output:
checking whether the gcc linker (/usr/bin/ld -m elf_x86_64) supports shared libraries... yes
Maybe your linker doesn't support the building of shared libraries? Just check your gcc installation again (apt-get update).

Categories