Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PHP not loading xdebug when started from Eclipse PDT [duplicate]

I have installed Eclipse and xDebug on Ubuntu 10.10.
When I debug some php file as a page, that works fine.
When I try to debug it as a script, I give the message that mysql extension is not loaded.
I set the following options for PHP executable:

  • Executable path: /usr/bin/php
  • PHP ini file: /etc/php5/apache2/php.ini
  • SAPI type: CLI
  • PHP debugger: XDebug

I wrote the following script:

test.php
<?php
$ext = get_loaded_extensions();
print_r($ext);
?>

When I put in command line /usr/bin/php test.php
I give 50 loaded modules include mysql and mysqli.
When I debug it as a page in Eclipse I give the same modules and xdebug.
When I debug it as a page in Eclipse I give 45 modules include xdebug, but mysql and mysqli are not loaded.

like image 428
Marko Novaković Avatar asked May 03 '26 03:05

Marko Novaković


2 Answers

after struggling with this issue for several hours today, I decided to manually cat all informations inside one single .ini file, and started eclipse with eclipse -clean. something like the following script should do the trick:

#!/bin/bash
mkdir /etc/php5/cli_eclipse
cat /etc/php5/cli/php.ini /etc/php5/conf.d/* > /etc/php5/cli_eclipse/php.ini

(you could obviously check if the dir is already existing etc. but this script is here for illustrative purposes only. you'll need to use a superuser account/sudo to execute this).

point your php runtime in eclipse under window -> preferences -> PHP -> PHP Executables to your created file and restart eclipse once with the -clean flag. pdt should create temporary "php.ini"s containing all necessary information.

like image 137
Andor Goetzendorff Avatar answered May 04 '26 23:05

Andor Goetzendorff


The Eclipse PDT team decided to introduce the -n option to fix the Bug #324073. So only php.ini from /tmp/zend_debug/... has been loaded, and all additional INI files have not been loaded.

This has been introduced since PDT 2.2.0 M201010110334 (2010/10/11).

For more information, see the following links:

  • http://redmine.piece-framework.com/issues/242
  • https://bugs.eclipse.org/bugs/show_bug.cgi?id=339547
  • https://bugs.eclipse.org/bugs/show_bug.cgi?id=347618
like image 41
iteman Avatar answered May 04 '26 23:05

iteman



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!