Xdebug error: "Error loading xdebug.so: xdebug.so: cannot open shared object file: there is no such file or directory"

I recently installed xdebug on my server, but limited its use on our test site, which uses its own php.ini .

For example, php.ini test sites are located at:

 /home/test_site/public_html/subdomain_name/php.ini 

Inside this php.ini , I have the following for xdebug:

 [XDebug] zend_extension = /usr/local/lib/php/extensions/no-debug-non-zts-20090626/xdebug.so xdebug.profiler_append = 0 xdebug.profiler_enable = 1 xdebug.profiler_enable_trigger = 0 xdebug.profiler_output_dir = /home/test_site/xdebug xdebug.profiler_output_name = "cachegrind.out.%s-%u.%h_%r" 

Now the fact is that xdebug is working fine, no problem.

However, on our main site, which also has its own php.ini , which is located, for example, at:

 /home/main_site/public_html/php.ini 

Inside this file I have nothing for xdebug there.

Now I recently installed cron in cpanel for the main site , for example:

 php -f /home/main_site/public_html/cron_jobs/main_cron.php > /home/main_site/public_html/logs/main_cron.log 2>&1 

Now, checking the cron output inside the log file, I get the output:

 Failed loading xdebug.so: xdebug.so: cannot open shared object file: No such file or directory 

Why am I getting this error when the main site should not even load xdebug?

+7
debugging php apache xdebug php-ini
source share
3 answers

Even though you have two sites separated and using two different php.ini files, CRON will still use any php.ini file that PHP-CLI is configured with. So, to find out which php.ini CRON is using, this is the command to use:

 php -i | grep php.ini 

If the PHP-CLI uses a php.ini file that you did not expect to use (for example, /usr/local/lib/php.ini ), then this will be the key to figuring out why you see Xdebug errors in the logs.

It turns out that in the file /usr/local/lib/php.ini these two values ​​were set:

 extension_dir = "/usr/local/lib/php/extensions/no-debug-non-zts-20090626" zend_extension = "xdebug.so" 

This caused an error from a php script that was run by CRON (i.e. PHP-CLI), because zend_extensions required the full path to the module. This is also indicated in the Xdebug documentation: http://xdebug.org/docs/install

So, to get rid of the error, just comment out this line (or just delete it). You can also comment or delete the extension_dir line until you load other modules, such as:

 extension = memcached.so 
+10
source share

For writing to Linux, Mint and I think in some Ubuntu Systems. To change php.ini, it is best to go to /etc/php/7.0/cli/conf.d and look for xdebug.ini, and you should change the lines indicated in the message above mine.

+2
source share

Sometimes it is difficult where the XDebug library is loaded from, as this can be done either by specifying a path in php.ini or by adding lib in available versions.

First run:

 $ sudo grep 'xdebug' -r /etc/php/* 

This will give you files that download the extension.

Now determine which php.ini is used:

 $ php -i | grep php.ini 

This will give you the version of php you are using (in case you have multiple php versions). Now link the php version to the result from the first step.

Now you need to comment on the line where the xdebug extension is loaded, or delete the xdebug.ini file (which loads the extension) from / etc / php / xx / mods -available (where xx stands for php version to use).

+1
source share

All Articles