I need to install a couple of PHP extensions, like memcache and geoip, on MAMP 3.5, for PHP 5.6.10.
What I'm doing is to run phpize:
/Applications/MAMP/bin/php/php5.6.10/bin/phpize
Which outputs:
Configuring for:
PHP Api Version: 20131106
Zend Module Api No: 20131226
Zend Extension Api No: 220131226
Then configure:
/configure --with-php-config=/Applications/MAMP/bin/php/php5.6.10/bin/php-config
And, afterwards, try to build with make. This is where I get this error:
/Applications/MAMP/bin/php/php5.6.10/include/php/Zend/zend.h:51:11: fatal error: 'zend_config.h' file not found
I downloaded the content of the include/php folder from php.net, version 5.6.10 (found here).
I feel I'm closer now to solving this problem, but I'm at loss with this error. What am I doing wrong, so that apparently the freshly downloaded php from php.net is missing files?
Thank you.
I ended up using pecl instead of manually compiling the extensions.
The headers missing on the make step were I didn't run ./configure on the php folder - I came across this step by chance, really.
Afterwards, all I had to do was run:
sudo /Applications/MAMP/bin/php/php5.6.10/bin/pecl install memcache
And everything was running on wheels.
Before trying pecl, I tried to run make as I was doing on my post, and the extension compiled successfully, but I had versions mismatch between the php and the extension. I had previously tried pecl without success, but I don't really know what changed in my configuration since I last tried.
Anyway, I wrote a gist with all my steps to get this working, in case anyone has the same problem and is a complete beginner on this subject like I am.
Related
I followed the instructions outlined here:
Install PHP Internationalization extension (Intl) on XAMPP on Mac
Ran sudo pecl install intl
selected the correct files from the Cellar
then this error happened:
/private/tmp/pear/temp/intl/intl_error.h:24:10: fatal error:
'ext/standard/php_smart_str.h' file not found
include
^ 1 error generated. make: *** [php_intl.lo] Error 1 ERROR: `make' failed
No matter, did some research and found out that PHP 7.0.8 deprecated php.smart_str.h to php.smart_string.h
So given my scant knowledge of C++ I copied smart_string.h to smart_str.h and renamed all the headers from STRING to string.....
re-ran pecl -no luck....more errors......without knowing where the .c files are and remaking php (not really interested in going that far) since anyway I'm using XAMPP so that ended that option.
I have php 5.5 on my mac, deep in the usr/local/bin folder
so next step was to get pecl to use those files and generate an intl.so file....
Did that....I have the intl.so file so put it in the 'extensions' folder in XAMPP (for reference: /Applications/XAMPP/xamppfiles/lib/php/extensions/no-debug-non-zts-20151012)
Ran php and came up with this error:
Warning: PHP Startup: Unable to load dynamic library
'/Applications/XAMPP/xamppfiles/lib/php/extensions/no-debug-non-zts-20151012/intl.so'
- dlopen(/Applications/XAMPP/xamppfiles/lib/php/extensions/no-debug-non-zts-20151012/intl.so,
9): Symbol not found: _zval_used_for_init Referenced from:
/Applications/XAMPP/xamppfiles/lib/php/extensions/no-debug-non-zts-20151012/intl.so
Expected in: flat namespace in
/Applications/XAMPP/xamppfiles/lib/php/extensions/no-debug-non-zts-20151012/intl.so
in Unknown on line 0
I imagine it has to do with different versions?
In any case I can't get pecl to install intl without a make error in PHP 7.0.8 on XAMPP. There is no documentation on this and you'd think that if you deprecate a header.h file you'd update all extensions?
Install intl.so in PHP 7 seems impossible?
After a lot of research I was finally able to resolve this. Detailed steps here:
before you begin, check which php path is set. it should be /Applications/XAMPP/xamppfiles/bin/php. If not you can change it by PATH="/Applications/XAMPP/xamppfiles/bin:${PATH}". more detail here
Overall idea is to build the intl-extension from PHP source code on your own. Before you begin make sure you have installed Xcode. Also, install the latest version of autoconf. this might help:
brew install autoconf
Next download the version of PHP you use in XAMPP from php.net. I am using 7.1.18. This version worked for me: php-7.1.31, I’m guessing if you follow the steps it might work for 7.0 or 7.2 as well. Do let me know if it does or doesnt, I’ll update this post. Do not use PHP 7.3 for Magento 2.3.0, it is not supported.
Extract the tar.gz file using (I extracted it inside ~/Downloads/ folder )
tar -xzvf php-7.1.31.tar.gz
cd into the extracted folder
cd php-7.1.31
change to subfolder ext/intl
cd ext/intl/
Run these commands to build the extension
/Applications/XAMPP/bin/phpize
./configure --enable-intl --with-php-config=/Applications/XAMPP/bin/php-config --with-icu-dir=/Applications/XAMPP/xamppfiles/
make
sudo make install
you can now delete all files you downloaded and also the extracted folders.
Open /Applications/XAMPP/xamppfiles/etc/php.ini , and add extension=intl.so
Restart your Apache using XAMPP GUI and it should work.
So far, it seems that extension intl.so for php is bundled with php
and should be compiled with php (intl --enabled). XAMPP does not support this (as of Oct 2016), MAMP does. I do not know about other distros. However, if you're willing to recompile PHP 7, it's worth it just to do that and enable it during compiling.
So....I ran with MAMP. Then I decided that I would simply install apache 2.4 and php 7 and Mysql without the stack and the junk that comes with MAMP or XAMPP and everything works like a charm... so if you need to use CakePHP or intl support etc... just drop XAMPP/MAMP and go with a standard install. I used homebrew (MacOS) and everything is working fine.
Update: As regards Windows, XAMPP does not default it, but you can add the module (dll) in php.ini and works like a charm
The error means that XAMPP doesn't have PHP compiled with intl. You may try:
pecl install intl
but probably it won't work as well.
See: PHP Bug #72879 Pecl install intl make error with PHP 7.0.8.
As for the workaround, try installing memcached extension instead of memcache, e.g.
pecl install memcached
Note: It also requires libmemcached package/library to be installed beforehand. For macOS, install via: brew install libmemcached.
If you wanna try without homebrew, with native apache and php, look at my aswer here: https://stackoverflow.com/a/55131868/3692846
I'm really at a loss with this, I just dont understand how to fix this error.
Xdebug requires Zend Engine API version 220121212.
The Zend Engine API version 220131226 which is installed, is newer.
I've read something about phpize but when I run the command I get...
Make sure that you run '/usr/local/bin/phpize' in the top level source directory of the module
I'm not sure what this means. What is the top level source directory?
Can anyone help me please?
Thanks
I found this which I think it will help you
https://xdebug.org/wizard.php
Edit
Also worth noting this FAQ guide here under Compilation and Configuration --> Q: What to do with: Xdebug requires Zend Engine API version xxxxxxxx. The Zend Engine API version 2xxxxxxxx which is installed, is newer.
Q: What to do with: Xdebug requires Zend Engine API version xxxxxxxx.
The Zend Engine API version 2xxxxxxxx which is installed, is newer.
A: This message means that you are trying to load Xdebug with a PHP version for which it wasn't built. If you compiled PHP yourself, it is most likely because you compiled Xdebug against PHP headers that belong to a different PHP version that you're running. For example, you're using PHP 5.3 and the headers you're using are still PHP 5.2. If you are using a pre-compiled binary, then you're using the wrong one.
To diagnose if this is your problem, make the following steps:
Check what the "Zend Extension" API number is of the PHP version that you are running by looking at phpinfo() (or "php -i") output. You can find it in the top part of the output, in the same block as the PHP logo and the PHP version. As examples, for PHP 5.2, the number is "220060519" and for PHP 5.3 it is "220090626".
Check what the output of "phpize" is when you're completing the compilation steps. The number that you're looking for is on the line that says "Zend Extension Api No".
If the two numbers from above do not match, you're compiling with the wrong PHP headers. Refer to the next FAQ entry to figure out which phpize to use.
it's easy, this is working on me. just install this
sudo apt install php7.3-xdebug
or you can choose your own php version. php7.1-xdebug, php7.2-xdebug and etc
Run: phpize --help This shows you the full path to phpize. This path should be the same as where you have the CLI binary, php-config and the "pear" and "pecl" binaries installed. If you run php-config --version it should show the same version of PHP that you're running. If it doesn't match up, and perhaps the wrong "phpize" binary is found on the path, you can run configure as follows:
/full/path/to/php/bin/phpize
./configure --with-php-config=/full_path_to_php-config
In my case on i used this path for lampp and it worked.
/opt/lampp/bin/phpize
./configure --with-php-config=/opt/lampp/bin/php-config
Or you can follow this xDebug Installation Wizard
I'm trying to save an old, failing web-server setup consisting of Fedora, PHP, PEAR, and Oracle.
With some difficulty (I'm very new to all four), I've been able to set up something similar on a newer system. I used Fedora 19, PHP 5.5.4 (with Apache 2.4.6), and Oracle 11g.
That just leaves PEAR.
Now, from what I understand, PEAR is some PHP code, like a library, which PHP Web Applications can use to save time from having to code them again - database connection, for example.
But I don't know what to do with it, or even how to get it. Copy paste from my old system? Download using the CLI using yum? Are there packages I need to be aware of, or is it just a one download-one install thing?
For instance, a basic PHP webpage with the following code:
<?php
phpinfo();
?>
works fine on the new server setup, so I'm assured that everything else is working. But when I try to load the PHP files from the other server, it returns an Internal Server Error. I checked the error_log files under /etc/httpd/logs, and most of the errors appear as below:
PHP Fatal error: require_once(): Failed opening required 'MDB2.php' (include_path='.:/usr/share/pear:/usr/share/php') in /var/www/html/hrweb/includes/functions.php on line 4
EDIT:
According to the PEAR Website, PEAR is included upon the installation of PHP, though not all modules / packages are there. Typing in the command pear in the CLI does confirm it is installed, though it does not help the issue.
I got the MDB2 package via pear install MDB2, though apparently, MDB2_Driver_oci8 is required. Whenever I try to download that, I get the following:
"MDB2_Driver_oci8" version "1.4.1" does not have REST XML available
In addition to this, I also tried to download OLE, which gets me the following:
No releases available for package "pear.php.net/OLE"
This was also previously the error of trying to download MDB2_Driver_oci8.
Thanks.
You have to install the (surprise!) MDB2 package to get MDB2.php:
$ pear install mdb2
and the adapter of your choice:
$ pear install mdb2_driver_mysql-beta
Then make sure the PEAR php directory is in your include path - see the PEAR manual.
"MDB2_Driver_oci8" version "1.4.1" does not have REST XML available
try to install the beta version:
$ pear install mdb2_driver_oci8-beta
No releases available for package "pear.php.net/OLE"
You're trying to install the stable version, but OLE does not have any stable version (yet): http://pear.php.net/package/OLE/download
Append either -alpha or -beta after OLE:
$ pear install OLE-beta
I have manually installed PHP on my mac which is running lion. I installed mcrypt as well. It was working fine until few days ago it stopped working (didn't load). Most probably this happened after the latest software update.
Now I am trying to install mcrypt again. I tried everything I could and followed most of the tutorials online. No luck yet.
Here is what I have done.
downloaded libmcrypt
configured and installed it.
I am running php 5.4.7
I downloaded the source. went to mcrypt folder and phpize.
configured and installed.
Edited the php.ini to add extension = mycrypt.so. Even tried putting the path in extension_dir.
restarted Apache. still doesn't work.
I have now spent days figuring this out but still cant work it out. I am in point where I am thinking of doing a clean install :(
These are the few things I have noticed that are wierd and may be the reason of problem.
When I do phpize this is what I get
Configuring for:
PHP Api Version: 20090626
Zend Module Api No: 20090626
Zend Extension Api No: 220090626
but when it finishes installing it gives me path to
/usr/lib/php/extensions/no-debug-non-zts-20100525/
Any help will be really appreciated. If you need any help I will provide any necessary details.
I’m trying to install Xdebug on a Linux machine for remote debugging of PHP. I’ve come across a number of issues in trying to build it, I appear to have resolved some but I feel stuck right now. Short description, “make” does not complete successfully, says it can’t find zend_config.h or TSRM_config.h. Not sure how to go about getting these.
More in-depth explanation: (note I’m not super Linux savvy so if you see something that I’ve done that is blatantly wrong, please let me know)
I’m trying to follow the instructions I received here from providing my phpinfo() details (see end of post). I was originally getting a number of errors similar to these when trying to “make”:
Error: ‘ZEND_USER_OPCODE_DISPATCH’ undeclared (first use in this function)
Error: ‘ZEND_RAISE_ABSTRACT_ERROR’ undeclared (first use in this function)
Etc.
My guess was that it wasn’t phpize’d with the proper version of Zend (if I’m wording that correctly). Going back to the phpize step, the versions that are returned do not line up with phpinfo(). Rather than seeing:
PHP Api Version: whatever
Zend Module Api No: 20060613
Zend Extension Api No: 220060519
I instead see:
PHP Api Version: 20020918
Zend Module Api No: 20020429
Zend Extension Api No: 20050606
To make things more complicated, I’m running an older version of XAMPP (1.6.8a) that allows me to switch between PHP 4.4.9 and PHP 5.2.6 (currently trying to transition PHP versions on my job and debugging would really speed things up). I currently have PHP5 mode running. Checking /opt/lampp/bin/phpize, I see that it’s a symbolic link to “phpize-5.2.6”. My guess is that XAMPP just switches the link depending on the version of PHP that it was told to start up with. Anyways, that part seems fine and I run phpize-5.2.6 for a sanity check and still get the old version numbers. Now, php-config is setup similarly, running php-config --version returns “5.2.6” which is just fine.
I do some more digging and run across this post (2nd to last in thread). I end up downloading the PHP source for version 5.2.17 (hopefully that’s close enough) and creating the soft link as described in the thread. Phpize versions look much better now and line up with what the Xdebug site says I should see:
PHP Api Version: 20041225
Zend Module Api No: 20060613
Zend Extension Api No: 220060519
“Make” is now throwing the missing header file errors listed above. I see this post and decide to play around with my configure file.
I commented out
-no-create | --no-create | --no-creat | --no-crea | --no-cre \ <br/>
| --no-cr | --no-c | -n)
no_create=yes ;;
And removed –no-create from this line:
set X '$SHELL' '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion
Still no luck. I assume configure is supposed to create these config files or something? Not sure what to try next. If it helps, I’m running SUSE SLES 10. Thanks.
Xdebug custom generated install instructions:
SUMMARY
• Xdebug installed: no
• Server API: Apache 2.0 Handler
• Windows: no
• Zend Server: no
• PHP Version: 5.2.6
• Zend API nr: 220060519
• PHP API nr: 20060613
• Debug Build: no
• Thread Safe Build: no
• Configuration File Path: /opt/lampp/etc
• Configuration File: /opt/lampp/etc/php.ini
• Extensions directory: /opt/lampp/lib/php/extensions/no-debug-non-zts-20060613
INSTRUCTIONS
1. Download xdebug-2.1.0.tgz
2. Unpack the downloaded file with tar -xvzf xdebug-2.1.0.tgz
3. Run: cd xdebug-2.1.0
4. Run: phpize
As part of its output it should show:
Configuring for:
...
Zend Module Api No: 20060613
Zend Extension Api No: 220060519
If it does not, you are using the wrong phpize. Please follow this FAQ entry and skip the next step.
5. Run: ./configure
6. Run: make
7. Run: cp modules/xdebug.so /opt/lampp/lib/php/extensions/no-debug-non-zts-20060613
8. Edit /opt/lampp/etc/php.ini and add the line
zend_extension = /opt/lampp/lib/php/extensions/no-debug-non-zts-20060613/xdebug.so
9. Restart the webserver
It looks like you are using an old version of PHP, which may mean that you are using a PHP package from your linux distribution.
If that's the case, first check if your distribution provides a xdebug package. If not, you may have to install the php*-dev or php*-devel package, in order to build a module.
So turns out I needed an additional flag when running configure:
--enable-xdebug
Pretty simple but the instructions I was using never mentioned this. Only found out about it after browsing through Xdebug's discussion list archive.
Note, though "make" seemed to work without error the first time I did this, I still did not get an xdebug.so file in modules/. I then did a "make clean", ran phpize again, configure and then make, this time I got the file.