![]() ![]() You can find these setting in the following menu: Then add server configuration and mapping in PHPStorm settings, like you always do. To be able to debug your Drupal project, you must have your project locally and on the remote server. Please note that 9000 port destination is Remote, so make sure you select the correct radio button while adding port mapping. 3306 is for MySQL and 9000 is for Xdebug. Just add a new tunnel to your existing connection and you are good to go.Īs you can see, I'm using two forwarded ports. If you are using Windows then Putty is the best tool. You need to set up a SSH tunnel between your local machine and the remote server. When you start to debug just click on the extension's icon and click on the Debug button. To make debugging easier you need to install Xdebug helper extension for Chrome web browser. Now you can restart PHP by executing: systemctl restart php7.0-fpm SSH to your server and open this file: vim /etc/php/7.0/fpm/php.iniĪnd add the following lines at the end of the file: Look for Loaded Configuration File value, and that is where you php.ini is located. You can do that by visiting the following page in your Drupal instance: Now you need to locate your php.ini file. To install Xdebug execute the following command: sudo apt-get install php-xdebug I will show you how to install Xdebug on Ubuntu 16.04 and PHP 7. You can of course apply the same technique to some other PHP framework or CMS.įirst step is to install Xdebug PHP extension. In this blog post I will show you, how you can easily set up remote debugging for Drupal projects. So, to be able to really follow the execution of your code and state of variables, you need to use a proper debugger. This can be a very time consuming process. ![]() You have to call these functions from your code and then inspect what will they print out on your screen. Old school method for debugging is good enough if you are debugging something simple, but when it comes to the more complex parts of your code, using var_dump or Devel is not good enough. You will reach a point when you need to see what is happening in your code. If you are working on some project that is not trivial and simple, then you know that it's not always a smooth sail. And when it comes to debugging Xdebug is certainly the best tool. W: Creating socket for 'locahost:9000', getaddrinfo: No such file or directory.To be a really efficient developer, you have to use the best tools available. I: Connecting to configured address/port: locahost:9000. This is the content of xdebug.log Log opened at 11:39:26 Here's my XDebug configuration in /etc/php/7.1/mods-available/xdebug.ini zend_extension=xdebug.so ![]() Xdebug.var_display_max_data => 512 => 512Īnd my browser is sending the correct cookie, as Debug was enabled from Xdebug Helper Firefox extension: Xdebug.var_display_max_children => 128 => 128 ace_enable_trigger_value => no value => no value Xdebug.show_exception_trace => Off => Off Xdebug.remote_log => /var/log/apache2/xdebug.log => /var/log/apache2/xdebug.log Xdebug.remote_addr_header => no value => no value Xdebug.profiler_output_name => cachegrind.out.%p => cachegrind.out.%p Xdebug.profiler_output_dir => /tmp => /tmp Xdebug.profiler_enable_trigger_value => no value => no value Xdebug.profiler_enable_trigger => Off => Off Xdebug.gc_stats_output_name => gcstats.%p => gcstats.%p Xdebug.gc_stats_output_dir => /tmp => /tmp Xdebug.force_display_errors => Off => Off Xdebug.filename_format => no value => no value Xdebug.file_link_format => no value => no value ace_output_name trace.%c trace.%cĪnd this one is the xdebug grep of php -i from command line: php -i | grep xdebug ace_enable_trigger_value no value no value ![]() Xdebug.remote_log /var/log/apache2/xdebug.log /var/log/apache2/xdebug.log Xdebug.remote_cookie_expire_time 3600 3600 Xdebug.remote_addr_header no value no value Xdebug.profiler_output_name cachegrind.out.%p cachegrind.out.%p Xdebug.profiler_enable_trigger_value no value no value Xdebug.gc_stats_output_name gcstats.%p gcstats.%p Xdebug.file_link_format no value no value This is the XDebug section of phpinfo() in my browser xdebug Where the Dynamic Port forwarding D1024 is used for the browser proxyĪnd the Remote Port forwarding R9000 localhost:9000 should be used for XDebugĪnd enabled it to listen PHP Debug Connections: To test my PHP project I connect to the remote server through a ssh tunnel (putty): I have a PhpStorm project with a remote deployment (Ubuntu Server 16.04) through ssh ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |