Ankit Rustagi
Ankit Rustagi

Reputation: 5637

phpize reports "Cannot find config.m4"

I am trying to run the 'phpize' command on MacOSx Mountain Lion, but this is what I get:

 Cannot find config.m4. 
 Make sure that you run '/opt/local/bin/phpize' in the top level source directory of the module

How do I resolve this error ?

Upvotes: 45

Views: 116841

Answers (7)

MD SHAYON
MD SHAYON

Reputation: 8063

Sometimes, using the pecl installer is not an option. This could be because you're behind a firewall, or it could be because the extension you want to install is not available as a PECL compatible package, such as unreleased extensions from git. If you need to build such an extension, you can use the lower-level build tools to perform the build manually.

The phpize command is used to prepare the build environment for a PHP extension. In the following sample, the sources for an extension are in a directory named extname:

$ cd extname
$ phpize
$ ./configure
$ make
# make install

Upvotes: 0

Hasib Arya
Hasib Arya

Reputation: 41

got inside the xdebug folder than try to run the phpize

Upvotes: 3

Rodrigo García
Rodrigo García

Reputation: 1417

My problem was that I was trying to execute the command just to see if I had it installed.

Trying to execute the command alone gives you that error, only use it inside the directory (most likely you downloaded) that contains the extension that you're trying to install.

Here some instructions to install Xdebug for php7.2 for example.

Take special care in step 3 and 4, first you change dir to the unpacked downloaded extension and then you run phpize.

Xdebug install instructions

Upvotes: 3

Mahesh
Mahesh

Reputation: 9

first run ./configure it will create config.m4 file, rest the steps are same

Upvotes: -3

Erin Geyer
Erin Geyer

Reputation: 12073

In plain English, it means you're running the command from the wrong directory. You need to be in the directory that contains the source for the extension you're trying to install.

For example, if you're trying to install mcrypt, like I was when I came across this stack overflow page, you need to be in php-5.6.24/ext/mcrypt and then run the command.

Upvotes: 15

gilcierweb
gilcierweb

Reputation: 2734

http://qiita.com/MasatoYoshioka@github/items/e542f39a6f1a3bc1f71e

In terminal

ls config.m4

ls config*

config.w32  config0.m4

cp config0.m4 config.m4

cd /usr/local/src/php-5.3.29/ext/zlib
phpize
./configure
make clean && make && make install

nano php.ini
 add extension=zlib.so

Upvotes: 2

nstCactus
nstCactus

Reputation: 5183

The phpize command is meant to be run at the top level of an extension source dir (this source dir should contain a file name config.m4).

See http://php.net/manual/en/install.pecl.phpize.php for more information.

Upvotes: 33

Related Questions