Dieses Blog durchsuchen

Sonntag, 14. August 2016

Xdebug: install on ubuntu 16.04 with PHP 7



Part I Installation of Xdebug

To prepare the usage of xdebug for php in phpstorm, for using a much better debugworkflow then var_dump or Zend_Debug::dump(),  we have to build and install the php extension.

Prerequisits

Installed apache2, php7
If you do not have php7 and apache installed, you can follow this post

Build xdebug for your system

At the moment I wrote this post i have to build xdebug 2.4.from sources, just by typing following commands

$ wget http://xdebug.org/files/xdebug-2.4.1.tgz
$ tar -xvzf xdebug-2.4.1
$ cd xdebug-2.4.1
$ phpize
$ cp modules/xdebug.so /usr/lib/php/201510/12
$ nano /etc/php/7.0/apache2/php.ini

Open your php.ini 
nano /etc/php/7.0/apache2/php.ini

and add follwing line at the end  
zend_extension = /usr/lib/php/20151012/xdebug.so 
xdebug.remote_enable=true
xdebug.remote_host=127.0.0.1
xdebug.remote_port=9000
xdebug.remote_handler=dbgp
xdebug.profiler_enable=1
xdebug.idekey=PHPSTORM

Open your cli/php.ini 
nano /etc/php/7.0/cli/php.ini

and add follwing line at the end  
zend_extension = /usr/lib/php/20151012/xdebug.so 
xdebug.remote_enable=true
xdebug.remote_host=127.0.0.1
xdebug.remote_port=9000
xdebug.remote_handler=dbgp
xdebug.profiler_enable=1
xdebug.idekey=PHPSTORM

This is necassary to add xdebug support to the comandline. So your phpstorm interpreter is able to run "debug" directly on the file.

restart your webserver
$ service apache2 restart
  

Thats pretty much it. At last, we want to check the build and the installation

Check the installation


Create a info.php
$ nano /var/www/html/info.php

add following line to the info.php
<?php phpinfo();

- open a phpinfo.php in your browser and copy the whole html content.
- visit https://xdebug.org/wizard.php  and paste the content into the textarea there.

on the follwing screen you should see a message like that:





  • Xdebug installed: 2.4.1





  • Server API: Apache 2.0 Handler
  • Windows: no
  • Zend Server: no
  • PHP Version: 7.0.8-0
  • 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

  • You're already running the latest Xdebug version

     

    In Part II we will configure PHPStorm to use the new php extension


    Thanks

    Peter

    Keine Kommentare:

    Kommentar veröffentlichen