среда, 15 мая 2013 г.

Configure PhpStorm for debugging

IDE: PhpStorm6
OS: Ubuntu 12.10

Configure IDE for debugging.

1) At first install and configure XDebug.

 My additional xdebug.ini options:
  • xdebug.remote_enable=On
  • xdebug.remote_host=localhost
  • xdebug.remote_port=9000
  • xdebug.max_nesting_level=250

Do not forget restart your web server with new configuration.
Also you can check if XDebug is used in phpinfo output.

2) Install and configure "Xdebug Helper" plugin in browser(chrome for example)
I using https://chrome.google.com/webstore/detail/xdebug-helper/eadndfjplgieldjbigjakmdgkmoaaaoc
Configuration options for it:
Or you can try another key from PhpStorm documentation page:

3) Configure PhpStorm:
Add your app server: File -> Settings -> PHP -> Servers (Debugger: Xdebug)
Configure debug options: File->Settings->PHP->Debug
  Xdebug | debug port - 9000
  Xdebug | Can accept external connections - checked

Run->Break at first line in PHP scripts - check it
Run->Start Listen PHP Debug Connections - enable listener
Go to debugging page in browser.
Click on gray bug icon and enable Debug.
After these actions all should be ready, so reload page(or send a form, or click on link, ...) and debug will start.

Thanks to authors from these resources:

среда, 20 февраля 2013 г.

Apache2 Negotiation: discovered file(s) matching request


 - Linux A230512 3.5.0-24-generic #37-Ubuntu SMP Thu Feb 7 01:50:30 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux
 - Apache/2.2.22

I trying to get page from local server by URL: http://<sitename>/index/index/site_id/6. There one input point "index.php", htaccess configured properly. But "Page not found" returned.

Apache log show this message "Negotiation: discovered file(s) matching request...". It mean you need to disable "MultiViews" in domain configuration.

1) Edit domain configuration file
> nano -w /etc/apache2/sites-available/<site-configuration-file>
2) Find this row "Options Indexes FollowSymLinks MultiViews" and remove phrase "MultiViews".
As a result you should have this "Options Indexes FollowSymLinks". Save file.

3) Restart apache
/etc/init.d/apache2 restart

OS Ubuntu 12.10, In your system routes and commands may be different.

среда, 16 января 2013 г.

Configure ZendDebugger for PHP5.4

OS: Ubuntu12.10 - Linux A230512 3.5.0-21-generic #32-Ubuntu SMP Tue Dec 11 18:51:59 UTC 2012 x86_64 x86_64 x86_64 GNU/Linux
Web server: Apache2
PHP: PHP 5.4.6-1ubuntu1.1  Zend Engine v2.4.0

Need to debug php scripts with ZendStudio10(beta!). But officially Zend doesn't produce Debugger for PHP v5.4, latest version for v5.3

Main idea: download ZendServer package for PHP5.4 get ZendDebugger from this pacakge and install it manually. Follow those steps and you will be fine!

1) Get deb package of ZendServer(depending your system 64 bit or 32) for PHP5.4
> wget http://repos-source.zend.com/zend-server/preview-php5.4/deb/pool/php-5.4-debugger-zend-server_5.3.33+b7_amd64.deb
2) Unpack it:
dpkg -x php-5.4-debugger-zend-server_5.3.33+b7_amd64.deb php54debugger
3) Copy ZendDebugger.so to the right place:
cp ./usr/local/zend/lib/debugger/php-5.4.x/ZendDebugger.so /usr/lib/php5/20100525/ZendDebugger.so
4) Copy zend debugger.ini to the right place:
cp ./usr/local/zend/etc/conf.d/debugger.ini /etc/php5/mods-available
5) Now you need to replace one string that ini file. Find this string
and replace it to this
6) Enable this ini file:
ln -s /etc/php5/mods-available/debugger.ini /etc/php5/fpm/conf.d/30-debugger.ini
7) Restart web server:
/etc/init.d/apache2 restart

This works for me from the box, no additional actions.

PS. All scripts and commands depends of your OS, in this version its Ubuntu.
Giant thanks to the author of this post original version