configure: error: Cannot find php-config. Please use --with-php-config=PATH
$./configure --with-php-config=/usr/local/php-7.4.12/bin/
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 for pkg-config... /usr/bin/pkg-config
checking pkg-config is at least version 0.9.0... yes
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 for system library directory... lib
checking if compiler supports -R... no
checking if compiler supports -Wl,-rpath,... yes
checking build system type... x86_64-pc-linux-gnu
checking host system type... x86_64-pc-linux-gnu
checking target system type... x86_64-pc-linux-gnu
configure: error: Cannot find php-config. Please use --with-php-config=PATH
Unsolvable !
If you notice above, I have already passed the --with-php-config path with the correct path, and the configure found php-config:
checking for pkg-config... /usr/bin/pkg-config
checking pkg-config is at least version 0.9.0... yes
What more can I do ?
In the configure.log I see
configure:3774: error: Cannot find php-config. Please use --with-php-config=PATH
Let's go see around line 3774:
| # Check whether --with-php-config was given. if test "${with_php_config+set}" = set; then : echo "PATH SET" withval=$with_php_config; PHP_PHP_CONFIG=$withval else echo "PATH NOT SET" PHP_PHP_CONFIG=php-configfi ext_output=$PHP_PHP_CONFIG |
So it runs directly the argument passed. They don't want the path (directory) where php-config is located, they want to fullpath of the binary !
Solution
./configure --with-php-config=/usr/local/php-7.4.12/bin/php-config
(...)
checking for gawk... gawk
checking for fileinfo support... yes, shared
checking for magic files in default path... not found
configure: error: Please reinstall the libmagic distribution
Damn! It fails again for another reason!
I had to cheat - I copied the text from my /opt/rh/rh-php73/root/usr/bin/php-config file to overwrite my /usr/bin/php-config file
Then I could get it to run