I installed php 5.3.10 from source and it runs fine. But when i tried to install extensions from source packages like xdebug and mongo i get the following output after running phpize
PHP Api Version: 20090626
Zend Module Api No: 20090626
Zend Extension Api No: 220090626
configure.in:3: warning: prefer named diversions
configure.in:3: warning: prefer named diversions
Notice that these are just warnings not failure. So i continued and used ./configure and then make and then make install. A message came like this
Installing shared extensions: /usr/local/lib/php/extensions/debug-zts-20090626/
I checked in the above directory and the extension's shared object(.so) was there. So i added the path to my php.ini and restarted apache. But the extension is not installed.
I googled it and found that the warnings come because the phpize path is not correct. I checked this by
phpize --help and it shows the path /usr/local/bin/phpize
also php-config version is 5.3.10
php-config -v and it shows version 5.3.10
Whats wrong and what is meant by those warnings?
EDIT:
When i try to install these extension from pecl i can install them successfully and i can see them installed in the output of phpinfo()
But i cant install mcrypt via pecl so i need some way of installing extensions using phpize
i know it's a old question, but to solve this problem, just run the command ./configure with the option "--with-php-config".
./configure --with-php-config=/usr/bin/php-config
Related
I am trying to install Xdebug on my Mac, since I am using MAMP for local development.
I tried using pecl to install Xdebug by running the following command in my terminal:
sudo pecl install xdebug
But the following happens:
hello-world:~ lois$ sudo pecl install xdebug
WARNING: channel "pecl.php.net" has updated its protocols, use "pecl channel-update pecl.php.net" to update
downloading xdebug-2.9.8.tgz ...
Starting to download xdebug-2.9.8.tgz (245,293 bytes)
...................................................done: 245,293 bytes
91 source files, building
running: phpize
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:
autom4te: need GNU m4 1.4 or later: /usr/bin/m4
ERROR: `phpize' failed
It looks like phpize is trying to locate some files which don't exist, and then fails.
There is no mention of those files in the xdebug installation page, so I am not sure what I did wrong.
Ok, so I finally found the solution to my problem.
First solution: if you are using MAMP
First, I am actually using MAMP for local development. If that is your case as well, you do not need to install Xdebug.
The reason is, Xdebug is already installed with MAMP.
There are only 2 things you need to do:
Modify the php.ini files in MAMP: https://dillieodigital.wordpress.com/2015/03/10/quick-tip-enabling-xdebug-in-mamp-for-osx/
Set up your IDE to use Xdebug. I am using VS Code, there are lots of tutorials on how to set up VS Code with Xdebug.
Second solution: you are not using MAMP, so you absolutely want to install Xdebug on your Mac
If you had the same problem I had with phpize, it is because newer versions of macOS have a different folder structure.
Xdebug expects a certain structure, which is not present anymore. In this case, take a look at this article: https://bbqsoftwares.com/blog/xdebug-catalina
Autoconf might be missing
run brew install autoconf and try again
on Apple M1 Silicon make sure to use arch -x86_64 sudo pecl install xdebug to install xdebug
I'm having trouble installing SPL_Types with pecl for MAMP 3.0.7.3. Note that I am NOT using the "Pro" version of MAMP. How can I install this, or any pecl package, for the basic version of MAMP?
When I run the pecl install pecl/SPL_Types command, the output is:
pecl install pecl/SPL_Types
downloading SPL_Types-0.4.0.tgz ...
Starting to download SPL_Types-0.4.0.tgz (8,388 bytes)
.....done: 8,388 bytes
6 source files, building
running: phpize
grep: /Applications/MAMP/bin/php/php5.6.2/include/php/main/php.h: No such file or directory
grep: /Applications/MAMP/bin/php/php5.6.2/include/php/Zend/zend_modules.h: No such file or directory
grep: /Applications/MAMP/bin/php/php5.6.2/include/php/Zend/zend_extensions.h: No such file or directory
Configuring for:
PHP Api Version:
Zend Module Api No:
Zend Extension Api No:
Cannot find autoconf. Please check your autoconf installation and the
$PHP_AUTOCONF environment variable. Then, rerun this script.
ERROR: `phpize' failed
I've read that with older versions of MAMP, there was an extra download available of "server components and libraries" that would supply the missing pieces. However, that appears not to be available any longer.
What is the correct procedure now?
It looks like you don't have autoconf installed. Try running this:
brew install autoconf
and see if that helps resolve the issue!
I am trying to build the memcached extension on OS X 10.9 Mavericks for use with the built in PHP 5.4, initially I tried pecl install memcached but that threw the following.
checking for zlib location... configure: error: memcached support requires ZLIB. Use --with-zlib-dir=<DIR> to specify the prefix where ZLIB headers and library are located
ERROR: `/private/tmp/pear/install/memcached/configure' failed
So I created a tmp directory and executed pecl download memcached, unzipped the code and cd'd to the appropriate directory.
Trying to phpize it returned the following:
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:
I had brew installed zlib a while ago and pointed ./configure at my installation.
./configure --with-zlib-dir=/usr/local/Cellar/zlib/1.2.8 I was greeted with the following error message:
checking for session includes... configure: error: Cannot find php_session.h
So now I'm wondering the best course of action here... /usr/include/ doesn't exist at all... is this a Mavericks thing? I don't remember having this problem in 10.8 at all.
I could try brew installing php-devel but I presume that isn't going to be the right version of what I need? Any help would be greatly appreciated here
Update
locate php_session.h reveals
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk/usr/include/php/ext/session/php_session.h
should I just ln -s this to the expected location or is there some way to do this via XCode? I have the command line tools installed...
run xcode-select --install to install the XCode5 Command Line Tools, then sudo pecl install memcache. You should be good to go.
After install XCode5 Command Line Tools as afessler sugest (xcode-select --install) I couldn't do the "sudo pecl install memcache" because pecl was missing.
I had to install PEAR and PECL following this guide: http://techtastico.com/post/como-instalar-pear-y-pecl-en-os-x-mavericks/.
Then all worked good. Thanks!
I had this problem and it was due to MAMP not having all the PHP sources.
I found this really helpful solution that explains how to download and configure them:
https://stackoverflow.com/a/11175197/369326
Note that the MAMP components doesn't include the extras for any versions of PHP higher than php 5.4.10 but you can download the extras from http://php.net/releases.
As said above but not using xcode install
Try installing pecl manually:
curl -O http://pear.php.net/go-pear.phar
sudo php -d detect_unicode=0 go-pear.phar
and then:
sudo pecl install memcache
See more at: http://jason.pureconcepts.net/2012/10/install-pear-pecl-mac-os-x/#sthash.x2LKdqj6.dpuf
I've installed php 5.4.0, and went to re-install Imagick, from Pecl. When doing so everything works well, but when apache starts the following error is logged and the extension is not loaded as it should be:
PHP Warning: PHP Startup: imagick: Unable to initialize module\
Module compiled with module API=20090626
PHP compiled with module API=20100525
These options need to match in Unknown on line 0
For the life of me I can't understand where "20090626" is coming from. phpize -v shows:
Configuring for:
PHP Api Version: 20100412
Zend Module Api No: 20100525
Zend Extension Api No: 220100525
And the same is printed when the pecl installation process starts. How do I correct this?
I had exactly the same problem as you when I compiled php from source. And had a previous php5-pear, php5-cli installed. I don't know why but I had to remove every single file still marked as "php5".
To find the files (should work on OSX too):
find / -name php5
Then just do rm -r /paths/that/are/listed/php5
When thats finished, just go into your bin folder of your new php installation and reinstall the mongo-driver with pecl. I had to do: sudo ./pecl uninstall mongo followed by sudo ./pecl install mongo
When the installation is finished, if you're using php-fpm dont forget do use sudo service php-fpm restart
Then it should work, check by typing (all this still in the php/bin folder):
sudo ./php -v
If you dont recieve any errors you should be good to go :)
//cubsink
I've installed the sphinx binaries and libraries and am now trying to install the PECL sphinx module.
My system is running OS X 10.6 with MAMP 1.8.2 installed. I try to install sphinx using the following command:
sudo pecl install sphinx
The PECL command outputs the following:
running: phpize
Configuring for:
PHP Api Version: 20090626
Zend Module Api No: 20090626
Zend Extension Api No: 220090626
The versions above don't match the versions listed when doing a phpinfo(). It seems that PECL is trying to complie against the built-in version of PHP.
If I ignore the errors and continue the it will successfully compile and place the sphinx.so file in:
/usr/lib/php/extensions/no-debug-non-zts-20090626/sphinx.so
when in fact it should be:
/Applications/MAMP/bin/php5/lib/php/extensions/no-debug-non-zts-20060613/
I've tried copying the sphinx.so file to the MAMP extensions dir but when I restart apache PHP displays the following warning:
PHP Startup: Unable to load dynamic library '/Applications/MAMP/bin/php5/lib/php/extensions/no-debug-non-zts-20060613/sphinx.so
I think this is because MAMP is 32bit and the built-in PHP is 64bit so PECL complies for 64bit. I might be completely wrong but I did read this when I goggled on the topic.
Does anyone know how to get PECL to map to the MAMP version of PHP instead of the built-in version?
If the "correct" version of PHP is installed in something like /Applications/MAMP/bin/php5/, and has the development tools included, you should have some version of the pecl command to go with it, some next to that directory.
If so, running that pecl command that corresponds to your "correct" version of PHP should help : it'll run the correct version of phpize, and will allow the extension to be compiled against the (once again) correct version of PHP.
You just have to hope that MAMP includes those commands -- I cannot check, as I don't have a mac.