phpize reports "Cannot find config.m4" - php

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 ?

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.

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.

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.

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

got inside the xdebug folder than try to run the phpize

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

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

Related

How to build a php extensions from tgz file using make?

Background
I use a RedHat machine without root access, no access to the yum packet manager and no Docker support. This is the policy unfortunately at my work.
I have configured Apache and PHP using a tar file in a folder. Also done same for MongoDB, now I try to configure the PHP drivers for MongoDB according to these instructions:
https://docs.mongodb.com/drivers/php/
However I get stuck on the first bullet:
sudo pecl install mongodb
Problem
Do I need PECL? Can the extension be downloaded manually, and added to PHP?
I have tried to download the mongodb extension manually from:
https://pecl.php.net/package/mongodb
How to compile it mongodb.so? I tried to run pecl on a machine where I have root access then I saw it downloaded the mongodb-1.10.0.tgz and run make (in output when installing).
When I unpack the tgz file manually, I am not able to run make. How to use the makefile.frag? How to run make?
Here is a link on how to build mongodb.so:
https://www.php.net/manual/en/mongodb.installation.manual.php
git clone https://github.com/mongodb/mongo-php-driver.git
cd mongo-php-driver
git submodule update --init
phpize
./configure
make all
sudo make install
You can also unpack the mongodb-1.10.0.tgz file with:
tar -xvf mongodb-1.10.0.tgz
phpize
make all
sudo make install

Having issues creating an php extension

I try to make a custom php extension for code Encryption purposes,
I followed this tutorial to make an custom extension: How to make a PHP extension
i get this warning when compiling the extension:
WARNING
The following arguments is invalid, and therefore ignored:
--enable-php-helloworld
i did all according to the tutorial, i build on windows.
what are possible things i do wrong.
I followed that section: https://stackoverflow.com/a/32575493/3103078
I replicated the code 1:1 (Os: Windows)
used commands:
phpize
configure --enable-php-helloworld
nmake
php -d extension=php_helloworld.so --re php_helloworld
Expected result:
>>>helloworld support
Actual Result:
>>>
reproduction:
mkdir php
start https://altushost-swe.dl.sourceforge.net/project/winflexbison/win_flex_bison3-latest.zip
set path=%path%;C:\your_path\to\bison
start https://altushost-swe.dl.sourceforge.net/project/gnuwin32/sed/4.2.1/sed-4.2.1-bin.zip
set path=%path%;C:\your_path\to\sed
start https://codeload.github.com/skvadrik/re2c/zip/refs/tags/2.1.1
set path=%path%;C:\your_path\to\re2c
start https://download.microsoft.com/download/5/C/3/5C3770A3-12B4-4DB4-BAE7-99C624EB32AD/windowssdk/winsdksetup.exe
rem after install
set path=%path%;C:\Program Files (x86)\Windows Kits\10\bin\10.0.17763.0\x64
start https://windows.php.net/downloads/releases/php-devel-pack-7.3.29-Win32-VC15-x64.zip
rem install upper in php dir
phpize
configure --enable-php-helloworld
nmake
php -d extension=php_helloworld.so --re php_helloworld
The issue was not utilizing the php-src inside the sdk.
Also, on windows you need to use php-sdk-binary-tools, else it wont work when you compile it.
I'll do a tutorial on this soon.

Where is php7 bin? PHP

I'm trying to install a PHP Extension on my Linux Server however the installation process is confusing.
They provide this instructions.
git clone https://github.com/longxinH/xhprof.git ./xhprof
cd xhprof/extension/
/path/to/php7/bin/phpize
./configure --with-php-config=/path/to/php7/bin/php-config
make && sudo make install
I done git clone on PHP Extensions Folder
The thing that confuse me is
/path/to/php7/bin/phpize
Where is php7 bin?
The closest thing i found is /usr/bin/php
but its an executable file.
Inside this directory
/usr/bin/
I have php , php7.4, php-config, phpconfig7.4

Error while building php extension on Ubuntu

I installed php5-dev, get php source, placed hello_world extension in
<php_source>/ext/hello.
I run this commands in hello dir:
phpize
./configure --enable-hello
make
But I have error: php.h not found :(
I tried to run ./configure in php source path, placed files from Zend/, TSRM/, main/ dirs to /ext/hello dir, but after running make I have many-many compiling errors. What I am doing wrong?
Try with
./configure --with-php-config=/path/to/php/bin/php-config --enable-hello

How do I install/use the phpize command?

I am intending to use SQLite 3 with PHP 5. I found this: http://packages.debian.org/etch/web/php5-sqlite3 but I am having problems with installation:
unzip & untar the package
run "phpize"
run "./configure --with-sqlite3=/path/to/your/sqlite3/install
make && make install
(optionally) copy DB/sqlite3.php to /path/to/php/lib/php/DB/sqlite3.php
I understand that phpize is a command used in cmd. But in which folder should I run this command? It seems that I don't have this command installed yet. How do I install this? I'm on Windows, and is using Wampserver for PHP.
Thanks!
The instructions you've got don't typically make sense for Windows, unless you're running GNU Make.
You ought to have a look at this:
http://us2.php.net/manual/en/sqlite3.installation.php

Categories