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
Related
What i should do when i run PHPIZE and get the error below ? I already installed xcode command line tools.
grep: /usr/include/php/main/php.h: No such file or directory
grep: /usr/include/php/Zend/zend_modules.h: No such file or directory
grep: /usr/include/php/Zend/zend_extensions.h: No such file or directory
Configuring for:
PHP Api Version:
Zend Module Api No:
Zend Extension Api No:
Potential better solution - force reinstall the header files. Fixed a ton of problems for me system wide.
Running the following command will reinstall the developer tools header files and should fix the issue.
$ sudo installer -pkg /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg -target /
For some reason, I found Xcode command line tools was not installed completely on my Mac, Finally I solved this problem as follow:
1. xcode-select --install
2. cd /Library/Developer/CommandLineTools/Packages/
3. open macOS_SDK_headers_for_macOS_10.14.pkg
Note: After doing step2, if there is no .pkg file in the dir. maybe this solution will not help you.
find the phpize and edit it,
~$ whereis phpize
phpize: /usr/local/bin/phpize
~$ vim /usr/local/bin/phpize
in my phpize script it is like that
prefix='/usr/local/php7' ## where you should edit
datarootdir='/usr/local/php7/php'
exec_prefix="`eval echo ${prefix}`"
phpdir="`eval echo ${exec_prefix}/lib/php`/build"
includedir="`eval echo ${prefix}/include`/php"
...
phpize_get_api_numbers()
{
# extracting API NOs:
PHP_API_VERSION=`grep '#define PHP_API_VERSION' $includedir/main/php.h|$SED 's/#define PHP_API_VERSION//'`
ZEND_MODULE_API_NO=`grep '#define ZEND_MODULE_API_NO' $includedir/Zend/zend_modules.h|$SED 's/#define ZEND_MODULE_API_NO//'`
ZEND_EXTENSION_API_NO=`grep '#define ZEND_EXTENSION_API_NO' $includedir/Zend/zend_extensions.h|$SED 's/#define ZEND_EXTENSION_API_NO//'`
}
if you comfirm that you have the header file but the phpize script configure is wrong ,you can edit the row
prefix='/usr/local/php7'
and php.h is in
$ pwd
/usr/local/php7/include/php/main
$ ls php.*
php.h
if not ,you can compile php by yourself
I had the same issue as described above, only I was trying to install xdebug on macOS Mojave.
I resolved the issue by executing:
sudo installer -pkg /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg -target /
After installing xdebug extentions as follows
Download xdebug-2.6.0alpha1.tgz
Unpack the downloaded file
Run: cd xdebug-2.6.0alpha1
Run: phpize
Run: ./configure
Run: make
Run: cp modules/xdebug.so
/usr/local/Cellar/php70/7.0.26_18/lib/php/extensions/no-debug-non-zts-20151012
Edit /usr/local/etc/php/7.0/php.ini and add the line zend_extension =
/usr/local/Cellar/php70/7.0.26_18/lib/php/extensions/no-debug-non-zts-20151012/xdebug.so
I get the error when run php -v
Failed loading /usr/local/Cellar/php70/7.0.26_18/lib/php/extensions
/no-debug-non-zts-20151012/xdebug.so:
dlopen(/usr/local/Cellar/php70/7.0.26_18/lib/php/extensions
/no-debug-non-zts-20151012/xdebug.so, 9): no suitable image found.
Did find:
/usr/local/Cellar/php70/7.0.26_18/lib/php/extensions/no-debug-non-zts-20151012/xdebug.so:
stat() failed with errno=20
When I use the service of Xdebug analyse popinfo() output, it will ask the exactly the same steps to do.
It am not sure what no suitable image found means. The path exists. Could anyone have any ideas how to fix it?
I sorted the problem out by adding
export PATH="$(brew --prefix homebrew/php/php70)/bin:$PATH"
on .bash_profile.
PHP 7.1 came with OSX 10.13.2, so default path was set to the pre-packed php, which shows the error on phpinfo.
I am following these instructions to download xdebug: http://xdebug.org/wizard.php. The output of the wizard was this:
Summary
Xdebug installed: no
Server API: Apache 2.0 Handler
Windows: no
Zend Server: no
PHP Version: 5.4.17
Zend API nr: 220100525
PHP API nr: 20100525
Debug Build: no
Thread Safe Build: no
Configuration File Path: /bitnami/mampstack-osx-x64/output/php/lib
Configuration File: /Applications/mampstack-5.4.17-2/php/etc/php.ini
Extensions directory: /Applications/mampstack-5.4.17-2/php/lib/php/extensions
giving these instructions
Download xdebug-2.2.3.tgz
Unpack the downloaded file with tar -xvzf xdebug-2.2.3.tgz
Run: cd xdebug-2.2.3 Run: phpize (See the FAQ if you don't have phpize.
Run: ./configure
Everything works properly up to step #4. In step #4 I get
MyMacBookAir$ ./configure
-bash: ./configure: No such file or directory
If I look in xdebug-2.2.3 I see that there is no file called configure -- but I do see a file called configure.in. Did I get .tgz that is missing the configure file? Or am I not understanding some part of the instructions properly?
Actually it could be a problem with phpize command
If it complains for autoconf ("Cannot find autoconf") then try next
curl -OL http://ftpmirror.gnu.org/autoconf/autoconf-latest.tar.gz
tar xzf autoconf-latest.tar.gz
cd autoconf-*
./configure --prefix=/usr/local
make
sudo make install
#akh2103 I assume you have your problem fixed by now but I leave this answer here for anybody else has this issue.
I've just suffered from the same problem. For me I was installing it on a linked directory
eg ~/Downloads was actually on /media/1234/Data/Downloads
For some reason when I transferred all my downloads onto my other HDD the other day the permissions have been haywire.
After I moved the initial xdebug file to my ~/.Desktop and unpacked it there I ran
chmod -R 0755 x-debug/
and then ran phpize
Then I could see the configure file that didn't appear when I tried to do it on my other HDD.
I hope this helps anybody else who suffered from this problem.
John
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
I'm trying to run the phpize command, but i keep getting this error message:
Cannot find config.m4
Make sure that you run '/usr/bin/phpize in top level source directory of the module
I have already installed php5-dev.