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
Related
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.
I use MAMP for local php development and recently needed to use php's pspell functions for a project. I found little help with this specific scenario (short of recompiling php, yuck) so this post explains how I got it done.
I am not positive but you may need xcode and xcode command line tools installed for this to work. This article might be helpful.
Install MacPorts if you don't have it already
Install aspell and the dictionary of your choice (I used "en"):
sudo port install aspell aspell-dict-en
note: for the next commands, you need to know the version of php you're running on MAMP. You can find this in the MAMP preferences under the PHP tab. For me it's 5.5.18
Download the php source for the version of php you are running,
unarchive it, and move into the pspell source directory:
cd ~/Downloads/php-5.5.18/ext/pspell
Now (being sure to use the proper phpize binary for your php version) do:
/Applications/MAMP/bin/php/php5.5.18/bin/phpize
You should see something like:
Configuring for:
PHP Api Version: 20121113
Zend Module Api No: 20121212
Zend Extension Api No: 220121212
Next:
./configure --with-php-config=/Applications/MAMP/bin/php/php5.5.18/bin/php-config --with-pspell=/opt/local/
And finally, build the module file:
make
You should now have two files inside the ./modules/ directory: aspell.so and aspell.la - copy them into your php's extensions directory:
cp ./modules/* /Applications/MAMP/bin/php/php5.5.18/lib/php/extensions/no-debug-non-zts-20121212
Now add the extension to your configuration file in /Applications/MAMP/bin/php/php5.5.18/conf/php.ini
extension=pspell.so
Finally, restart your MAMP servers and (hopefully) you are good to go!
Quick background.
Running OSX Mavericks.
Want to run xdebug in NetBeans
Pear runs okay
xdebug stopped running after OSX upgrade. Tried to reinstall. During the install I get:
Configuring for:
PHP Api Version: 20100412
Zend Module Api No: 20100525
Zend Extension Api No: 220100525
But in phpinfo:
PHP API 20121113
PHP Extension 20121212
Zend Extension 220121212
Best thing I can figure out (after hours of trawling through similar issues) is to make sure I am using the correct version of phpize.
which phpize returns:
/Applications/MAMP/bin/php/php5.5.3/bin/phpize
whereis phpize returns:
/usr/bin/phpize
My question is in two parts:
Is the different PHP API Version likely to stop xdebug from running and; how can I make sure that I am using the correct version of phpize?
A wrong API makes Xdebug to not even load, so yes, that is a problem.
To use the correct one, you will need to figure out which php binary you use in the first place. It is likely that if you use MAMP's php binary, its in the same directory as the phpize you need to use. The same for /usr/bin/phpize, which should match /usr/bin/php's API numbers. phpinfo() output might give you hints as to which PHP binary is being used.
I am trying to compile the imagemagick (imagick) extension to use in a non-thread-safe environment on windows.
I am using PHP 5.3.10 and have set up Visual C++ express as my compiling environment.
The problem is that I am using a non-thread-safe version of PHP as a FCGI module in Apache 2.2.
Thus, my PHP is supplied with a php5.lib and not a php5ts.lib. I believe this is the reason why I am getting these errors:
imagick.obj : error LNK2019: unresolved external symbol __imp__tsrm_mutex_alloc referenced in function _zm_startup_imagick
I have only ever built and compiled things on linux, so am not too sure how to do this on a windows environment.
How can I compile the extension so that it is non-thread-safe?
I downloaded the threadsafe binary of PHP 5.3.10 to get a copy of php5ts.lib. I was then able to compile the extension.
I am guessing that setting the ZTS preprocessor directive to either 1 or 0 would cause the extension to compile as either threadsafe or non-thread-safe. (Not too sure about this, so if someone could let me know if this is correct or not, it would be much appreciated. :) )
I then set up a virtual machine running Windows 7 and installed the latest version of WAMP. Reason being that it used a threadsafe version of PHP.
I placed the dll in the ext folder in the PHP installation and enabled it in php.ini. However, even after trying both the ts and nts version in WAMP, I would get:
PHP Warning: PHP Startup: Unable to load dynamic library 'c:/wamp/bin/php/php5.3.10/ext/imagick.dll' - The specified module could not be found.
in Unknown on line 0
But the thing is that c:/wamp/bin/php/php5.3.10/ext/imagick.dll' does exist, and yes I have checked this a lot of times.
I then downgraded ImageMagick to 6.6.2-10-Q16, but still see the same problem.
The same issue occurs on my dev machine running a nts version of PHP 5.3.10 on Apache 2.2 (all installed manually).
Looks like I could be wrong regarding the ZTS preprocessor. If I set ZTS=0 and compile, using dependency walker on the compiled dll still shows that it requires php5ts.dll which is only present on threadsafe versions of PHP.
I did more tinkering with dependency walker and found that I had to statistically link to msvc100d.dll. I then removed ZTS in the preprocessor definition and was able to compile using php5.lib instead of php5ts.dll. I think this should get me a non-ts dll.
However, when loading the extension, I am still getting:
PHP Warning: PHP Startup: Invalid library (maybe not a PHP library) 'imagick.dll' in Unknown on line 0
And errors from dependency walker:
Error: At least one module has an unresolved import due to a missing export function in an implicitly dependent module.
Error: Modules with different CPU types were found.
Warning: At least one delay-load dependency module was not found.
Warning: At least one module has an unresolved import due to a missing export function in a delay-load dependent module.
Installed visual c++ express 2008 and compiled using platform toolkit v90, but still facing the same issues.
Any tips appreciated :)
Solution Found! See my answer.
Got it! I hope this can help those compiling php extensions on windows in the future. What I have done is based on: https://wiki.php.net/internals/windows/stepbystepbuild
Note: I read an answer on this site that said compiling PHP extensions by itself on windows is unsupported. Based on my experiments yesterday, it seems to be a lot of work as well, so I am using the PHP build process.
The best way is to use the PHP build process.
Install Visual C++ Express 2008 (any version will do, but express is free) and Windows SDK 6.1 (note that we want the 6.1 version not anything older or newer).
Install the SVN client tools if you haven't done so and restart for your PATH variable to take effect.
Get the PHP SDK binary tools and extract it to C:\php-sdk.
Start the CMD Shell under Microsoft Windows SDK v6.1 in your start menu and run cd C:\php-sdk.
Run setenv /x86 /xp /release this creates a 32-bit release. You can use /x64 to build a 64-bit release (I have not tried this).
run bin\phpsdk_setvars.bat
run bin\phpsdk_buildtree.bat php53dev
Download the PHP source code and extract it to C:\php-sdk\php53dev\vc9\x86 so that you end up with C:\php-sdk\php53dev\vc9\x86\php5.3-xyz
Download the latest deps and extract everything to C:\php-sdk\php53dev\vc9\x86. You may be prompted to overwrite any existing folders, so press yes.
run cd C:\php-sdk\php53dev\vc9\x86
Check out the latest version of your extension from the svn repository: svn co http://svn.php.net/repository/pecl/imagick/trunk pecl/imagick I am checking out imagick here.
Install any dependencies. In my case, I need to install ImageMagick, so I downloaded the latest recommended windows binary. You will need to restart after installation to update your PATH variable, but you can do this after you have compiled. Make sure you install the C/C++ headers and includes as well.
Copy the contents of the includes directory from the ImageMagick install directory to C:\php-sdk\php53dev\vc9\x86\deps\include.
Copy the contents of the lib directory from the ImageMagick install directory to C:\php-sdk\php53dev\vc9\x86\deps\lib
Now, let's build: run cd C:\php-sdk\php53dev\vc9\x86\php5.3-xyz then buildconf then configure --help. Look at the help properly. It will show you all config flags and any avaliable extensions to enabled. In my case, since I added imagick, I had an option called --with-imagick
Run config: configure --enable-cli --with-imagick=shared --disable-zts If you want to build a non-thread-safe binary use --disable-zts, otherwise remove that configuration flag. I am not sure why, but sometimes extensions use the --with-myextension flag and sometimes --enable-myextension, so check configure --help for the flag to use. If you add =shared after the extension flag, it will be compiled as a separate DLL, which si what we want.
Compile: run nmake then nmake snap.
Done :) Check C:\php-sdk\php53dev\vc9\x86\php-5.3.10\Release (non-thread-safe) or C:\php-sdk\php53dev\vc9\x86\php-5.3.10\Release_TS (thread-safe). Your compiled binaries should be in there. The compiled extensions (pecl), should be in a ZIP file similiar to pecl-5.3.10-nts-Win32-VC9-x86.zip. Open this file and extract the extensio DLL to your ext folder in your PHP installation.
Enable the PHP extension and restart your webserver. Run phpinfo() and check that the extension is enabled.
If the extension does not work properly, make sure you reboot to update your PATH variable. In my case, I need to have the imagemagick install directory in my PATH variable.
???
Profit!
Is there a reason you need to compile? Why not download? It's usually much simpler/quicker on Windows.
VC6: http://www.sk89q.com/2010/03/vc6-windows-binaries-for-imagick-2-3-0/
VC9: http://valokuva.org/builds/
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.