Ran the xdebug wizard but still have php version confusion - php

When I run php -v I get
PHP 5.6.32-1+ubuntu16.04.1+deb.sury.org+1 (cli)
So then I go to xdebug wizard, paste in the output from php -i, follow the steps
When I run phpize I get
Cannot find build files at '/usr/local/lib/php/build'. Please check your PHP installation
So I did phpize5.6 and got
PHP Api Version: 20131106
Zend Module Api No: 20131226
Zend Extension Api No: 220131226
which matches the wizard. Now when I run ./configure, I get
checking Check for supported PHP versions... configure: error: not supported. Need a PHP version >= 5.5.0 and < 7.2.0 (found 5.3.10)
However, if I run it like ./configure --with-php-config=php-config5.6
I can get the end of the wizard. It says to
Run: cp modules/xdebug.so /usr/lib/php/20131226
Edit /etc/php/5.6/cli/php.ini and add the line
zend_extension = /usr/lib/php/20131226/xdebug.so
But now I get
Failed loading /usr/lib/php/20131226/xdebug.so: /usr/lib/php/20131226/xdebug.so: undefined symbol: zend_pass_function
So it looks like there is something wrong with the php installation. It seems to use 5.3, but php -i shows 5.6. Do you have any ideas on why that is and how I could best resolve it?

Ok, so I solved this by first searching /usr for 5.3.10
This led me to see that I had used phpbrew a while ago, although I was using the system-installed version of php rather than the phpbrew version.
Switching to the phpbrew version 5.6 (instead of the system 5.6) resolved the error.
In future I can remove phpbrew and go back to the regular php following advice here.

Related

How to change phpize to current version

I'm using Mojave OS X and I've been following these steps to install Xdebug through Pecl. I'm trying to set it up so I can use the debugger of PHPStorm.
http://www.devinbaldwin.com/2018/09/27/how-to-install-xdebug-on-a-new-mac-including-mojave/
This is my current setup:
Xdebug installed: no
Server API: Command Line Interface
Windows: no
Zend Server: no
PHP Version: 7.3.6
Zend API nr: 320180731
PHP API nr: 20180731
Debug Build: no
Thread Safe Build: no
OPcache Loaded: yes
Configuration File Path: /usr/local/etc/php/7.3
Configuration File: /usr/local/etc/php/7.3/php.ini
Extensions directory: /usr/local/lib/php/pecl/20180731
I've followed all the steps but got stuck at installing Xdebug because I didn't have phpize.
I've installed the newest version of Xcode to create phpize, this worked at first, but I was having trouble appending the php.ini through PHPStorm because the file was read-only and I've thought of following another guide which talks about downgrading PHP to version 7.2 and installing Xdebug through that version, which is how this problem started.
When I tried to install Xdebug through Pecl, I've got this error.
downloading xdebug-2.7.2.tgz ...
Starting to download xdebug-2.7.2.tgz (230,987 bytes)
.................................................done: 230,987 bytes
69 source files, building
running: phpize7.2
sh: phpize7.2: command not found
ERROR: 'phpize' failed
At the sh, it never showed phpize7.2 before, it used to show phpize without the numbers.
I've tried to uninstall and reinstall homebrew and remove all php versions and installed the current php version as posted above.
I just want to know how I can revert phpsize to the current version. I've tried using PHP 7.2 but I still got the same error.
I've tried this guide since I'm using the latest PHP version, which is 7.3.
https://sys.cuquejo.org/install-php-7-3-xdebug-on-macos-mojave-with-homebrew/
But I still get the same error.
In addition, when I typed phpsize I got this:
Cannot find config.m4.
Make sure that you run '/usr/local/bin/phpize' in the top level
source directory of the module
However, when I typed phpsize --help
Usage: /usr/local/bin/phpize [--clean|--help|--version|-v]
Typing phpize72 --help would only show this:
-bash: phpize7.2: command not found
I'm not sure why this happened but any explanations could help.

PHP 7.1 iMap Extension Doesn't Show Up After Installation on Mojave

I have been trying to enable PHP 7.1 iMap extension on MAC Mojave 10.14.5, but I haven't had any luck getting it to work. Any help will be greatly appreciated.
Before any installation, php -v returns 7.1.23 and which php returns /usr/bin/php since Mojave has PHP 7.1 preinstalled. However, php -m doesn't include iMap since the extension is not installed by default.
I have tried to tap with either kabel/php-ext or
v1shky/php-ext and brew install php#7.1-imap, got the following in the installation process:
The php.ini and php-fpm.ini file can be found in:
/usr/local/etc/php/7.1/
php#7.1 is keg-only, which means it was not symlinked into /usr/local,
because this is an alternate version of another formula.
If you need to have php#7.1 first in your PATH run:
echo 'export PATH="/usr/local/opt/php#7.1/bin:$PATH"' >> ~/.bash_profile
echo 'export PATH="/usr/local/opt/php#7.1/sbin:$PATH"' >> ~/.bash_profile
For compilers to find php#7.1 you may need to set:
export LDFLAGS="-L/usr/local/opt/php#7.1/lib"
export CPPFLAGS="-I/usr/local/opt/php#7.1/include"**
And when I check, php -v returns 7.1.30, which php returns /usr/local/bin/php and php -m still doesn't include iMap.
Then I followed the instruction to modify bash_profile, and now php -v returns 7.1.30 and which php returns /usr/local/opt/php#7.1/bin/php. However, php -m still doesn't include iMap.
Is there a better way to add the iMap extension for the existing PHP 7.1 that comes with Mojave? If not, is there anything else I should do when using HomeBrew so that it would work?
By the way, I have to stay on PHP 7.1 instead of upgrading to 7.2 or 7.3 due to some other frameworks we are using.
Thanks in advance!

XDEBUG installation reading wrong PHP version

I have an Ubuntu 16.04 vagrant box running on php 7.1. When I try to build xdebug by running ./configure in xdebug-2.6.0 I get
Check for supported PHP versions... configure: error: not supported. Need a PHP version >= 7.0.0 and < 7.3.0 (found 5.5.9-1ubuntu4.24)
PHP -v yields
Xdebug requires Zend Engine API version 320170718.
The Zend Engine API version 320160303 which is installed, is outdated.
PHP 7.1.15-1+ubuntu14.04.1+deb.sury.org+2 (cli) (built: Mar 6 2018 11:27:08) ( NTS )
So the system is running 7.1, but for some reason the configure script thinks we're still on 5.5.9
I've hit google pretty hard, but still can't find a way to update the Zend engine either.
Any ideas?
It happens because you're configuring with default settings and that is different from the PHP version you're trying to configure.
Just like you saw the PHP version using the php -v command, check the php-config version using the php-config --version command, it should be the same as php -v, but in your case, it would be different and hence this issue.
Now let's talk about how we can solve it. Since you need a different version of config, you should point that to the configure command.
For example, in your case, you need php-config7.1 (because you're using PHP v7.1, similarly for 7.2 you have php-config7.2 and so on)
To point the configure command to a specific PHP version you need to specify that as a flag called with-php-config and the value should be the location of the php-config file, a sample would be
./configure --with-php-config=/usr/bin/php-config7.1
Hope this solves the problem.
I assume you run phpize before running ./configure. Instead you need to run phpize7.1 and then ./configure
if you don't have phpize7.1 installed you can install it via:
sudo apt install apt install php7.1-dev

Xdebug requires different Zend version

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

OSX 10.9 xdebug wrong phpize

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.

Categories