xdebug for php 7 on ubuntu 14.04 - xdebug

I'm trying to get xdebug working on PHP 7. I'm build the xdebug.so file from version http://xdebug.org/files/xdebug-2.4.0rc4.tgz. The phpize output looks correct (Zend Extension Api No: 320151012) however I get Xdebug requires Zend Engine API version 220121212. from PHP.
So I've followed these instructions:
Tailored Installation Instructions
Summary
Xdebug installed: no Server API: Apache 2.0 Handler Windows: no Zend
Server: no PHP Version: 7.0.9-1 Zend API nr: 320151012 PHP API nr:
20151012 Debug Build: no Thread Safe Build: no Configuration File
Path: /etc/php/7.0/apache2 Configuration File:
/etc/php/7.0/apache2/php.ini Extensions directory:
/usr/lib/php/20151012 Instructions
Download xdebug-2.4.1.tgz Unpack the downloaded file with tar -xvzf
xdebug-2.4.1.tgz Run: cd xdebug-2.4.1 Run: phpize (See the FAQ if you
don't have phpize.
As part of its output it should show:
Configuring for: ... Zend Module Api No: 20151012 Zend Extension
Api No: 320151012 If it does not, you are using the wrong phpize.
Please follow this FAQ entry and skip the next step.
Run: ./configure Run: make Run: cp modules/xdebug.so
/usr/lib/php/20151012 Edit /etc/php/7.0/apache2/php.ini and add the
line zend_extension = /usr/lib/php/20151012/xdebug.so Restart the
webserver
With the exception that I've installed php7.0-dev instead of php5 apt-get install -y php7.0-dev.
When I run the phpize command I get the following output:
Configuring for:
PHP Api Version: 20151012
Zend Module Api No: 20151012
Zend Extension Api No: 320151012
As expected. However when I run PHP I get:
Xdebug requires Zend Engine API version 220121212.
The Zend Engine API version 320151012 which is installed, is newer.
Contact Derick Rethans at http://xdebug.org/docs/faq#api for a later
version of Xdebug.
I'm obviously doing something wrong somewhere! Any help on debugging the issue is very appreciated! :)

So I fixed this by using the apt-get package:
apt-get install -y php-xdebug
This seems to install the correct xdebug.so file and everything is working!

Related

Undefined subroutine &main::open_quote called at /usr/local/bin/autom4te line 262

Hi I try to install xdebug via pecl on macox (Big Sur 11.5.2)
But I get error message
xdebug volodymyr$ pecl install xdebug
downloading xdebug-3.0.4.tgz ...
Starting to download xdebug-3.0.4.tgz (215,870 bytes)
.............................................done: 215,870 bytes
87 source files, building
running: phpize
Configuring for:
PHP Api Version: 20190902
Zend Module Api No: 20190902
Zend Extension Api No: 320190902
Undefined subroutine &main::open_quote called at /usr/local/bin/autom4te line 262.
ERROR: `phpize' failed
I update perl but it did help me (I can't catch if the open_quote is a part of perl)
Also I didn't find any information in the internet that is related with open_quote function issue
I tried to install xdebug from source and get the same bug on the ./phpize step
Resolve:
Just reinstall autoconf automake libtool
I run
brew reinstall autoconf automake libtool
After that I run brew link --force autoconf and it resolved the trouble
The error here comes from autom4te, not pecl or ./phpize. You need to update automake and autoconf, and/or related packages.

PHPUnit gives No Code Coverage Driver Is Available

I have a laravel project and I tried to run phpunit to give me a coverage report. I ran the command vendor/bin/phpunit --coverage-html storage/test-output-data/coverage-html and it gave the output:
PHPUnit 8.5.8 by Sebastian Bergmann and contributors.
Error: No code coverage driver is available
I tried to resolve this situation by doing a sudo pecl install pcov, but running the phpunit still gave the same error above.
I noticed that I have the file /usr/lib/php/20170718/pcov.so. So I added the line extension=/usr/lib/php/20170718/pcov.so to my /etc/php/7.4/cli/php.ini file. But when I type php -v, I get this error:
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php/20170718/pcov.so' (tried: /usr/lib/php/20170718/pcov.so (/usr/lib/php/20170718/pcov.so: undefined symbol: _zval_ptr_dtor), /usr/lib/php/20190902//usr/lib/php/20170718/pcov.so.so (/usr/lib/php/20190902//usr/lib/php/20170718/pcov.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0
PHP 7.4.11 (cli) (built: Oct 10 2020 19:44:50) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
with Zend OPcache v7.4.11, Copyright (c), by Zend Technologies
I also have a folder called /usr/lib/php/20190902 but it does not have a pcov.so file.
I also tried doing a sudo pecl install xdebug, but I run into similar errors as above where phpunit says there's no driver and typing php -v says some global variable is missing similar to the pcov issue.
What am I doing wrong?
I noticed that I have the file /usr/lib/php/20170718/pcov.so. So I added the line extension=/usr/lib/php/20170718/pcov.so to my /etc/php/7.4/cli/php.ini file.
This file is for PHP 7.2 (based on 20170718 part) while you are trying to use it in PHP 7.4.
You need to get the right version of Xdebug (or PCOV) for your PHP 7.4. (NOTE: for PHP 7.4 the API version (and the right folder in the path) will be 20190902.)
Try this solution from the following answer to switch / install extensions via PECL for specific PHP version (7.4 instead of your current 7.2): https://stackoverflow.com/a/54594604/783119
sudo pecl -d php_suffix=7.4 install <package-name>
This has nothing to do with PHPUnit. You have a problem with your PHP environment: "PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php/20170718/pcov.so' (tried: /usr/lib/php/20170718/pcov.so (/usr/lib/php/20170718/pcov.so: undefined symbol: _zval_ptr_dtor), /usr/lib/php/20190902//usr/lib/php/20170718/pcov.so.so (/usr/lib/php/20190902//usr/lib/php/20170718/pcov.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0"
You just need to install xdebug, so the coverage knows how to run.
For example, for PHP 7.1, it's this package:
sudo apt install php7.1-xdebug
Just fixed it today for my scenario. In your case, just change the PHP version to:
sudo apt install php7.4-xdebug

How to intall drush on hostgator servers

I would like to have Drush on Hostgator shared hosting. I just spent 1 hour trying various outdated tutorials (Drush now requires composer). Does somebody have proved, tested and working solution how to install Drush there? I'm using PHP 5.4.
My last achieved step is drush st error:
Unable to load autoload.php. Drush now requires Composer in order to install its dependencies and autoload classes. Please see README.md
Content-type: text/html
When I run php composer.phar diagnose I see:
Content-type: text/html
Warning: Composer should be invoked via the CLI version of PHP, not the cgi-fcgi SAPI
Checking platform settings: OK
Checking git settings: OK
Checking http connectivity: OK
Checking disk free space: OK
Checking composer version: OK
Incase it helps others, I had been using a variety of google inspired resources to install Drush, which just complicated the situation for me. I would highly recommend following the official documentation which is the main source of information. I even read on there that they only maintain the documentation here, not even on drupal.org.
I was missing this step based on other instructions,
Now add Drush to your system path by placing export
PATH="$HOME/.composer/vendor/bin:$PATH"
into your ~/.bash_profile (Mac OS users) or into your ~/.bashrc (Linux users).
These instructions helped me resolve the error:
curl -sS https://getcomposer.org/installer | php mv composer.phar
/usr/local/bin/composer ln -s /usr/local/bin/composer
/usr/bin/composer
git clone https://github.com/drush-ops/drush.git /usr/local/src/drush
cd /usr/local/src/drush git checkout 7.0.0-alpha5 #or whatever
version you want. ln -s /usr/local/src/drush/drush /usr/bin/drush
composer install drush --version
I think you are trying to use Drush version 7.x.
Try using Drush 6.x, I don't think it requires composer. Drush releases. I have had drush 6.4 installed on shared hosting environment successfully without any problems.

Update to last version after already installed old

I'm using fastcgi and my PHP version is 5.3.3 instead of 5.5 so my question is how can I update to latest PHP version? I'm using CentOS, I tried yum update, but no update appeared for this.
Normally you need to uninstall the 5.3 branch and install 5.5 from scratch because it is not an update but a new version.
Beware that in 5.5 quite some functions are deprecated that were still available in 5.3!
http://blog.ahughes.org/?p=717
Uses the remi repository.
From the blog:
By running the following commands:
rpm -Uvh http://download.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm
rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-6.rpm
you solve all dependency issues with epel and remi on CentOS 6.
Then, by running the following command, you install PHP 5.5.
yum --enablerepo=remi,remi-test install httpd php php-common
For extra goodies, you can run the following command:
yum --enablerepo=remi,remi-test install php-pecl-apc php-cli php-pear php-pdo php-mysqlnd php-pgsql php-pecl-mongo php-sqlite php-pecl-memcache php-pecl-memcached php-gd php-mbstring php-mcrypt php-xml
Now, restart your httpd service and set it to boot automatically:
service httpd restart
chkconfig --levels 235 httpd on
Now run:
php --version
to see whether the correct version of PHP was installed.

Mac Ports Update Failing

hansarijanto$ port -v
MacPorts 2.0.3
hansarijanto$ xcodebuild -version
Xcode 4.3.2
Build version 4E2002
I am running the above xcode and macport version. on max os x
when I try to self update my mac port I get the following error.
hansarijanto$ sudo port selfupdate
Password:
---> Updating MacPorts base sources using rsync
MacPorts base version 2.0.3 installed,
MacPorts base version 2.0.4 downloaded.
---> Updating the ports tree
---> MacPorts base is outdated, installing new version 2.0.4
Installing new MacPorts release in /opt/local as root:admin; permissions 0755; Tcl-Package in /Library/Tcl
Error: /opt/local/bin/port: port selfupdate failed: Error installing new MacPorts base: shell command failed (see log for details)
I am trying to update mac port to install qt.
sudo port install qt4-mac-devel(error no SDK found)
which I need to install webkit-capybara
sudo gem install capybara-webkit -v '0.7.2'(error in setting up native environment)
You need to use the -d option to get enough information to diagnose this; but take a look at https://trac.macports.org/wiki/FAQ#selfupdatefails for common problems and solutions.
Seems Apple no longer installs Xcode's command line tools. See here: http://ericwilson.erics.ws/ericsblog/2012/8/26/macports-port-selfupdate-fail for solution.
Just wanted to add that on Mac OS 10.12 Sierra i was getting the WARNING: GNUSTEP_SYSTEM_ROOT is not defined error on selfupdate and i did already have the Xcode command line tools installed, licensed and working. But my copy of Xcode had become out of date, even though that was not showing up on the automatic software updates.
I had version 7 and for Sierra (and macports) you need version 8.
So I manually downloaded Xcode 8 via the App Store and it solved the problem for me.

Resources