- PHP extension not built with same debug and thread safe as PHP
- configure: error: Cannot find php-config. Please use —with-php-config=PATH
- Unsolvable !
- Solution
- CentOS6 PHP extension install: Cannot find php-config. Please use —with-php-config=PATH
- Saved searches
- Use saved searches to filter your results more quickly
- how to set php-config #1752
- how to set php-config #1752
- Comments
- configure: error: Cannot find php-config. Please use —with-php-config=PATH
- Related videos on Youtube
- John
- Comments
PHP extension not built with same debug and thread safe as PHP
Its hard to say what exactly was going wrong, I can only say that the extension was build using a different config than the php version.
I will describe some reproducible steps how to compile a most basic extension with debug symbols within the PHP source folder. The extension contains no code except of some boilerplate code created by ext_skel . It just describes the compilation process on UNIX. It is a shell script, you might execute it.
#!/bin/sh # Should work for all PHP5 versions VERSION="5.6.9" # Download the PHP source code wget \ --continue "http://de2.php.net/get/php-$VERSION.tar.gz/from/this/mirror" \ -O "php-$VERSION".tar.gz tar xf "php-$VERSION.tar.gz" && cd "php-$VERSION/ext" # Create a hello extension from skeletons ./ext_skel --extname="hello" # Uncomment two lines in ext/hello/config.m4 # Read the comments there and you'll know what I'm doing sed -ri.original \ -e 's/(dnl )(PHP_ARG_ENABLE\(hello)/\2/' \ -e 's/(dnl )(\[ --enable-hello)/\2/' \ hello/config.m4 # Build PHP and the extension cd .. ./buildconf --force ./configure \ --enable-debug --enable-maintainer-zts \ --enable-hello=shared make -j # Test if it is working sapi/cli/php \ -dextension=modules/hello.so \ -r 'var_dump(extension_loaded("hello"));'
You can now start to enter code to ext/hello/hello.c and create your extension. If you want to compile the changes you make just issue make without arguments.
Since we’ve compiled using —debug we you can now use gdb to debug the C code and explore how PHP internally works. To start a debugging session use:
gdb sapi/cli/php . (gdb) break main (gdb) run -dextension=modules/hello.so some.php
Of course you’ll mostly set breakpoints into your extension functions rather than in the php main() function once you’ve added code to the extension. However, this should show the basic steps to get there.
configure: error: Cannot find php-config. Please use —with-php-config=PATH
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
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:
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
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!
CentOS6 PHP extension install: Cannot find php-config. Please use —with-php-config=PATH
This may seem trivial to some, but I have been developing on Windows all my life and only moved to Linux this week — all is new to me. I’ve been following The following guide on how to install php extensions on Linux. It worked perfectly for the mbstring extension, however, when I tried to do the exact same for bz2 and curl, I would get the error: configure: error: Cannot find php-config. Please use —with-php-config=PATH Has anyone encountered this error before and could shed some light in terms a rookie could understand? Both extensions came with the PHP 5.5 source. My commands used and their outputs are as follows: Find php-config:
[Art@art ~]$ sudo find -name php-config ./php/scripts/php-config
[Art@art bz2]$ cd ~/php/scripts [Art@art scripts]$ ls -ltr total 48 -rw-r--r--. 1 Art Art 4690 May 28 09:06 phpize.m4 -rw-r--r--. 1 Art Art 4499 May 28 09:06 phpize.in -rw-r--r--. 1 Art Art 2070 May 28 09:06 php-config.in -rw-r--r--. 1 Art Art 1744 May 28 09:06 Makefile.frag drwxr-xr-x. 3 Art Art 4096 May 28 09:06 dev drwxr-xr-x. 2 Art Art 4096 May 28 09:06 apache -rw-r--r--. 1 root root 4522 Jun 25 09:16 phpize -rw-r--r--. 1 root root 2260 Jun 25 09:16 php-config drwxr-xr-x. 2 Art Art 4096 Jun 25 09:16 man1
[Art@art scripts]$ cd ~/php/ext/bz2 [Art@art bz2]$ phpize Configuring for: PHP Api Version: 20121113 Zend Module Api No: 20121212 Zend Extension Api No: 220121212
[Art@art bz2]$ sudo ./configure --with-php-config=~/php/scripts/php-config checking for grep that handles long lines and -e. /bin/grep checking for egrep. /bin/grep -E checking for a sed that does not truncate output. /bin/sed checking for cc. cc checking for C compiler default output file name. a.out checking whether the C compiler works. yes checking whether we are cross compiling. no checking for suffix of executables. 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 for system library directory. lib checking if compiler supports -R. no checking if compiler supports -Wl,-rpath. yes checking build system type. x86_64-unknown-linux-gnu checking host system type. x86_64-unknown-linux-gnu checking target system type. x86_64-unknown-linux-gnu configure: error: Cannot find php-config. Please use --with-php-config=PATH
Usage: /usr/local/bin/php-config [OPTION] Options: --prefix [/usr/local] --includes [-I/usr/local/include/php -I/usr/local/include/php/main -I/usr/local/include/php/TSRM -I/usr/local /include/php/Zend -I/usr/local/include/php/ext -I/usr/local/include/php/ext/date/lib] --ldflags [] --libs [-lcrypt -lresolv -lcrypt -lrt -lrt -lm -ldl -lnsl -lxml2 -lz -lm -lxml2 -lz -lm -lxml2 -lz -lm -lcrypt -lxml2 -lz -lm -lxml2 -lz -lm -lxml2 -lz -lm -lcrypt ] --extension-dir [/usr/local/lib/php/extensions/no-debug-zts-20121212] --include-dir [/usr/local/include/php] --man-dir [/usr/local/php/man] --php-binary [/usr/local/bin/php] --php-sapis [ apache2handler cli cgi] --configure-options [--with-apxs2=/usr/local/apache2/bin/apxs --with-mysql] --version [5.5.13] --vernum [50513]
Saved searches
Use saved searches to filter your results more quickly
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
how to set php-config #1752
how to set php-config #1752
Comments
i want to install phalcon in my computer, but it’s get error «Cannot find php-config» when i run command «sudo ./install»
I use lampp for php server, how to fix it?
fendi@fendi-K40IJ:/media/sda7/xampp/htdocs/_coba/phalcon/cphalcon/build$ sudo ./install
32bits
Configuring for:
PHP Api Version: 20100412
Zend Module Api No: 20100525
Zend Extension Api No: 220100525
checking for grep that handles long lines and -e. /bin/grep
checking for egrep. /bin/grep -E
checking for a sed that does not truncate output. /bin/sed
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 gcc accepts -g. yes
checking for gcc option to accept ISO C89. none needed
checking how to run the C preprocessor. gcc -E
checking for icc. no
checking for suncc. no
checking whether gcc and cc understand -c and -o together. yes
checking for system library directory. lib
checking if compiler supports -R. no
checking if compiler supports -Wl,-rpath. yes
checking build system type. i686-pc-linux-gnu
checking host system type. i686-pc-linux-gnu
checking target system type. i686-pc-linux-gnu
configure: error: Cannot find php-config. Please use —with-php-config=PATH
The text was updated successfully, but these errors were encountered:
configure: error: Cannot find php-config. Please use —with-php-config=PATH
To use php-config you will need to have the PHP development package installed, in Ubuntu you can install the PHP5 development package using:
sudo apt-get install php5-dev
After installing the php5-dev package, (on my Ubuntu installation) php-config can be found in:
Related videos on Youtube
John
We consult and build stuff out of Toronto!
Updated on September 17, 2022
Comments
I’m trying to install a program called phraseanet. I ran the ./configure command and run into this error:
configure: error: Cannot find php-config. Please use --with-php-config=PATH
I am using Ubuntu 10.04, Apache 2, PHP5 and Mysql 5 Does anyone know where I can find the php-config? I can’t find that file.
You can get the same error with php 8 as php-config was renamed to php-config8 . I solved the issue creating a symbolic link ln -s /usr/bin/php-config8 /usr/bin/php-config
Note that the right php-config might be /usr/bin/php-config54 or /usr/bin/php-config55, etc. according to your PHP verison.