Xdebug bad Zend API Version Number - mamp

I am having trouble upgrading xdebug for MAMP. I was running version 2.2.0 and there was a known issue that I ran into: PhpStorm and Xdebug not breaking in Symfony2 Controller
I tried to upgrade to version 2.2.3 by following the instructions from http://xdebug.org/wizard.php
After downloading and extracting the xdebug tar I ran /Applications/MAMP/bin/php/php5.4.4/bin/phpize
Here is the output:
Configuring for:
PHP Api Version: 20100412
Zend Module Api No: 20100525
Zend Extension Api No: 220100525
I then copied the modules/xdebug.so file into the mamp php5.4.4 extensions dir: `/Applications/MAMP/bin/php/php5.4.4/lib/php/extensions/no-debug-non-zts-20100525/xdebug.
If I run /Applications/MAMP/bin/php/php5.4.4/bin/php -v I get the following:
Xdebug requires Zend Engine API version 220090626.
The Zend Engine API version 220100525 which is installed, is newer.
Contact Derick Rethans at http://xdebug.org/docs/faq#api for a later version of Xdebug.
PHP 5.4.4 (cli) (built: Jul 4 2012 17:28:56)
Copyright (c) 1997-2012 The PHP Group
Zend Engine v2.4.0, Copyright (c) 1998-2012 Zend Technologies
I have restarted MAMP and Apache and tried loading a page with phpinfo() and I do not see Xdebug listed. If I moved the old xdebug.so file back in place the error is removed and phpinfo() show xdebug as enabled

I managed to solve this issue by running
/Applications/MAMP/bin/php/php5.4.4/bin/pecl install xdebug At first I was seeing issues with the Zend API number using pecl. I followed this post: pecl installs for previous php version and set the following:
sudo /Applications/MAMP/bin/php/php5.4.4/bin/pear config-set php_ini /Applications/MAMP/bin/php/php5.4.4/conf/php.ini
sudo /Applications/MAMP/bin/php/php5.4.4/bin/pecl config-set bin_dir /Applications/MAMP/bin/php/php5.4.4/bin/
Not sure if these configs had something to do with it failing before

I have a MAMP server set up on a Mac Pro, I could not get xDebug to work. This was in my logs:
PHP Warning: PHP Startup: xdebug: Unable to initialize module
Module compiled with module API=20160303
PHP compiled with module API=20170718
These options need to match
in Unknown on line 0
This can be fixed by installing the latest xDebug.so. My problem with doing so was that is was writing to the wrong xDebug.so,not the MAMP server:
Build process completed successfully
Installing '/usr/lib/php/extensions/no-debug-non-zts-20160303/xdebug.so'
ERROR: failed to write /usr/lib/php/extensions/no-debug-non-zts-20160303/xdebug.so (copy(/usr/lib/php/extensions/no-debug-non-zts-20160303/xdebug.so): failed to open stream: Operation not permitted)
The second line of #Shawn's answer was the solution:
sudo /Applications/MAMP/bin/php/php7.2.7/bin/pecl config-set bin_dir /Applications/MAMP/bin/php/php7.2.7/bin/
I was then able to build the latest xDebug.so to the right directory using pecl install xdebug.

Related

how to fix issue when magento upgrade from 2.3.4 to 2.4.3?

I'd like to upgrade magento from 2.3.4 to 2.4.3.
But I cannot upgrade it.
this is error.
Your requirements could not be resolved to an installable set of packages.
Problem 1
- Root composer.json requires magento/product-community-edition 2.4.3 -> satisfiable by magento/product-community-edition[2.4.3].
- magento/product-community-edition 2.4.3 requires php ~7.3.0||~7.4.0 -> your php version (7.2.34) does not satisfy that requirement.
Problem 2
- Root composer.json requires dealerdirect/phpcodesniffer-composer-installer ^0.5.0 -> satisfiable by dealerdirect/phpcodesniffer-composer-installer[v0.5.0].
- dealerdirect/phpcodesniffer-composer-installer v0.5.0 requires composer-plugin-api ^1.0 -> found composer-plugin-api[2.2.0] but it does not match the constraint.
Use the option --with-all-dependencies (-W) to allow upgrades, downgrades and removals for packages currently locked to specific versions.
I am using cpanel now. In cpanel I set php version is 7.4
PHP 7.4.33 (cli) (built: Nov 10 2022 11:12:07) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
with Zend OPcache v7.4.33, Copyright (c), by Zend Technologies
what is the reason?
See if you're really using php 7.4 by typing php -v in the terminal. When you are sure that your php version is correct, delete the composer.lock file (make a backup beforehand). Try updating with the command:
composer require magento/product-community-edition:2.4.5 -W
If that doesn't work, post the contents of the composer.json file
If you are migrating from 2.3.4 to 2.4.3, you need to make the following and please follow these below steps:
1: Backup composer.json: Run the command
cp composer.json composer.json.bak
2: Upgrade your Magento: Run the commmand
composer require-commerce magento/<product> <version> --no-update [--interactive-root-conflicts] [--force-root-updates] [--help]
3: Update the dependecies:
composer update
For example, Specify the metapackage:
Magento Open Source: composer require-commerce magento/product-community-edition 2.4.4 --no-update
Adobe Commerce: composer require-commerce magento/product-enterprise-edition 2.4.4 --no-update
4: Composer Update: Run composer update
5: Update the database schema and data. bin/magento setup:upgrade
6: Disable Magento maintenance mode. bin/magento maintenance:disable
7: Restart Varnish. (Optional) Restart Varnish If you use it for page caching: service varnish restart
Please switch to PHP 7.4 first then check perform the upgrade.

Install mongodb on mac os 10.15 for php7

I have installed mongodb on my mac Catalina 10.15. I have php7.3 version installed as well. Now, I want to use the mongoClient() class with PHP. I tried composer require mongodb/mongodb but it says that the mongodb extension is missing :
Using version ^1.5 for mongodb/mongodb
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.
Problem 1
- mongodb/mongodb 1.5.1 requires ext-mongodb ^1.6 -> the requested PHP extension mongodb is missing from your system.
- mongodb/mongodb 1.5.0 requires ext-mongodb ^1.6 -> the requested PHP extension mongodb is missing from your system.
- Installation request for mongodb/mongodb ^1.5 -> satisfiable by mongodb/mongodb[1.5.0, 1.5.1].
To enable extensions, verify that they are enabled in your .ini files:
- /etc/php.ini
You can also run `php --ini` inside terminal to see which files are used by PHP in CLI mode.
Installation failed, reverting ./composer.json to its original content.
So I tried to install the extension for php using the php doc and I get this error :
pear/install/mongodb/php_phongo.c -fno-common -DPIC -o .libs/php_phongo.o
/private/tmp/pear/install/mongodb/php_phongo.c:22:10: fatal error: 'php.h' file not found
#include <php.h>
^~~~~~~
1 error generated.
make: *** [php_phongo.lo] Error 1
ERROR: `make' failed
Any help ?
I also had the same issue after upgrading to MacOS Catalina
Run these two commands;
brew doctor
brew link --overwrite php
I fixed that by installing PHP7.3 using homebrew
here is a post that helped Install PHP 7.3 + xdebug on MacOS Catalina (with homebrew)
I also updated the macos to 10.15 catalina and started the setup. As same as error came during installing the mongodb driver
After Resolving my issue I updated the answer by given below steps:
Step 1:
Run the command: brew install php71
Step 2:
Edit httpd.conf under directory of /etc/apache2/httpd.conf
Add below line
LoadModule php7_module /usr/local/opt/php#7.1/lib/httpd/modules/libphp7.so
then check there should be no other php7_module enabled.
Also add these lines
<FilesMatch \.php$>
SetHandler application/x-httpd-php
</FilesMatch>
Step 3: Restart apache: sudo apachectl restart
Step 4:
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"
Step 5:
To have launched start php#7.1 now and restart at login:
brew services start php#7.1
Step 6:
Open new terminal & check php version & it should be 7.1
Step 7:
Then run the command: sudo pecl install MongoDB
& it will install php mongodb driver successfully without any error.
Make sure all step should be followed!!
I did these steps to resolve my MongoDB driver issue for laravel project which not found.

Zend Framework 3 [UnexpectedValueException] Invalid version string "^1.1.0"

I am trying to install Zend Framework 3 in Windows 7. I downloded the Skeleton from Git and run composer install. But getting the error
[UnexpectedValueException] Invalid version string "^1.1.0".
Details:
PHP Version 5.6.3,
XAMPP Version 5.6.3
I'm not sure what command you ran and why you downloaded the skeleton. The preferred way to install the skeleton is with composer:
composer create-project zendframework/skeleton-application path/to/install
More info can be found on https://framework.zend.com/downloads/skeleton-app

imagick and mongo on OSX lion with brew

I am trying to install imagick and mongo on osx lion. Note that my php installation is done via homebrew. I have installed the packages correctly and it should work but php returns the following
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
PHP Warning: PHP Startup: mongo: 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
Any clues on how to fix that?
The PHP errors indicate that you've compiled extensions for a different API version (20090626 API is PHP 5.3) from the server you are trying to use the extensions with (20100525 API is PHP 5.4).
I suspect that you have installed PHP 5.4 via homebrew, but managed to pick up the OS X default headers (PHP 5.3) when compiling the extensions. You need to either recompile your extensions with PHP 5.4, or downgrade your web server to PHP 5.3.
You can check the version of PHP headers in your path using php-config:
php-config --version
And the version of PHP and extension API with:
php -i | egrep "PHP (Extension|Version)"
Possible fixes:
Include /usr/local/bin in your path first so the homebrew PHP versions are found in preference to the system default:
export PATH=/usr/local/bin:$PATH
Install PHP 5.3 via Homebrew:
brew uninstall php54
brew install php53
For reference, I'd like to add that
when brew installs php it sets the additional ini files read folder to
/usr/local/etc/php/5.4/php5/conf.d
whilst it actually is
/usr/local/etc/php/5.4/conf.d
you can easily fix that by symlinking
cd /usr/local/etc/php/5.4/
mkdir php5
cd php5
ln -s ../conf.d .

PHP :mbstring module install

I have tried to install the mbstring module for PHP. I have entered the below commands:
yum install php-mbstring
/usr/local/apache/bin/apachectl restart
Module is now installed but the errors has not dissapeared.
Fatal error: Call to undefined function mb_send_mail()
In my phpinfo(), "mbstring" doesn't exist...
OS: centos 6
PHP: 5.3.8
How did you install PHP on your system? The PHP version currently supported via YUM install is 5.3.3, but you said your PHP version is 5.3.8 which leads me to believe that you may have compiled PHP manually. If so, you will have to recompile with the --enable-mbstring flag.