brew php54-xdebug Failed loading xxx.xdebug.so Symbol not found - php

I used brew install php54-xdebug,then I found php.ini and added some confs.
[xdebug]<br>
zend_extension="/usr/lib/php/extensions/no-debug-non-zts-20121212/xdebug.so"<br>
xdebug.remote_enable = On<br>
xdebug.remote_handler = "dbgp"<br>
xdebug.remote_host = "localhost"<br>
xdebug.remote_port = 9000<br>
xdebug.idekey = PHPSTROM<br>
I found this xdebug.so file get through zend_extension, when i tried to use less to open this file content, it pointed out xdebug.so" may be a binary file. See it anyway?
When I used php -a or do some other things about php, it will point out:
Failed loading
/usr/lib/php/extensions/no-debug-non-zts-20121212/xdebug.so:
dlopen(/usr/lib/php/extensions/no-debug-non-zts-20121212/xdebug.so,
9): Symbol not found: _zend_execute_ex Referenced from:
/usr/lib/php/extensions/no-debug-non-zts-20121212/xdebug.so Expected
in: flat namespace in
/usr/lib/php/extensions/no-debug-non-zts-20121212/xdebug.so
Interactive shell

Find where your xdebug was located:
sudo find / -name xdebug.so
It will take some minutes.

Related

Xdebug .so file exists but still reported not found

This is /etc/php/7.2/cli/conf.d/20-xdebug.ini content:
zend_extension=xdebug.so
xdebug.remote_enable=on
xdebug.remote_autostart=off
and this is the error I get by running php:
PHP Warning: Failed loading Zend extension 'xdebug.so' (tried: /usr/lib/php/20170718/xdebug.so (libc.musl-x86_64.so.1: cannot open shared object file: No such file or directory), /usr/lib/php/20170718/xdebug.so.so (/usr/lib/php/20170718/xdebug.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0
However /usr/lib/php/20170718/xdebug.so exists and has read permission:
# ls -l /usr/lib/php/20170718/xdebug.so
-rw-r--r--. 1 root root 2078128 Jan 16 11:15 /usr/lib/php/20170718/xdebug.so
Changing extension path to full path doesn't make a difference either.
What can be the reason?
It seems that shipped xdebug module was corrupted and installing it through apt solved the issue:
apt install php-xdebug
I also tried and compiled source code many times before installing it through apt but I got the same error every time I did. Yet the exact cause remains unknown.
Refer to the below link as I think it will solve your problem as it did for me
Installing Xdebug
Try this content inside your xdebug.ini file
zend_extension=xdebug.so
xdebug.remote_enable = 1
xdebug.remote_port = 9000
xdebug.show_error_trace = 1 <--- you can skip this
xdebug.remote_autostart = 0
I imagine you are using a mac, the C header files are no able to be reached via /usr/include. There are a few ways to fix this, but compiling it yourself is probably the best way. I would recommend https://bbqsoftwares.com/blog/xdebug-catalina if you don't want to turn SIP off.

In PHPstorm after configuration xdebug, stepover is disabled yet.what should I do? and one addition warning

Please guide me
No one here knows how to solve the problem!?
I use PHPstorm 2017.2.4 for php programming.
I configured phpstorm to debug by xdebug for use stepover and stepintro in debugging by jetbrain guid documents but just debugging is enable yet and other options is disable. screen shot of this:
How can I and What should I check to resolve this problem?
I googled and search in stackoverflow but I couldn't find my answer.
Update:
I couldn't solve that yet.
I explain all steps I have done :
first o all say that I use wamp 2.4 for local host server.(php 5.4.12, apache 2.4.4 , MySQL 5.6.12)
1- install phpstorm for use debugger such as step over an step into debugging.
2- use jetbrain guide documents to install debugger:
first check to find xdebug in wamp directory.
then edit last lines of php.ini file in wamp as following:
[xdebug]
zend_extension = "c:/wamp/bin/php/php5.4.12/zend_ext/php_xdebug-2.2.3-5.4-vc9-x86_64.dll"
xdebug.remote_enable = 1
xdebug.profiler_enable = 1
xdebug.profiler_enable_trigger = off
xdebug.profiler_output_name = cachegrind.out.%t.%p
xdebug.profiler_output_dir = "c:/wamp/tmp"
3-Set php interpreter as follow image:
4-Then validate debugger here that don't disply any warning:
5-Enable listening for PHP debugger connection
6- Install chrome toolbar JetBrains IDE Support for web debugging.
7- I wentback to PHPstorm to debugging but just debug option was enabled and others was disabled as first image in this post.
In addition, after debugging the codes, the warning : "PHP Warning: include_once(): Failed opening '.\dref.php' for inclusiondisplay this warning. (include_path='.;C:\php\pear') in C:\wamp\www\srn\mrt\req_v.php on line 260" is displayed, while the same code works well in the WAMP(localhost:80) by Firefox browser.
in all php documents that has code similar to below :
include_once ('.\jd.php');
require_once(".\dref.php");
require_once(".\scur.php");
Then when I changed path for example ".\dref.php" in require_once to "..\dref.php" debugging dont display above warning ,But this timewhen open web by Firefox(localhost:80-wamp) display Warning: require_once(..\dref.php): failed to open stream: No such file or directory in C:\wamp\www\srn\mrt\req_v.php on line 26
Where do I make mistakes and how should I solve these problems?
Please guide me
No one here knows how to solve the problem!?

Installing php-module using port on osx lion. It works from command line but not from apache

I installed php5-intl on my osx lion.
It seems to work properly on command line mode because if I try to run the following script (1):
$fmt = datefmt_create( "en_US" ,IntlDateFormatter::FULL,IntlDateFormatter::FULL,'America/Los_Angeles',IntlDateFormatter::GREGORIAN );
echo "First Formatted output is ".datefmt_format( $fmt , 0)."\n";
> php -m |grep intl
intl
> php test.php
First Formatted output is Wednesday, December 31, 1969 4:00:00 PM Pacific Standard Time
But if I try to sun the same from my apache (after sudo apachectl restart) I get the following error:
> tail /private/var/log/apache2/error_log
PHP Fatal error: Call to undefined function datefmt_create() in
P.S.:
I also added the following line to my php.ini
extension_dir = "/opt/local/lib/php/extensions/no-debug-non-zts-20090626"
ll /opt/local/lib/php/extensions/no-debug-non-zts-20090626
total 848
-rwxr-xr-x 1 root 261712 7 May 10:54 xdebug.so
-rwxr-xr-x 1 root 168912 31 May 19:53 intl.so
in php.ini is written: Loaded Configuration File /private/etc/php.ini which is the file I edited.
Other info on my configuration are the following:
/private/etc/apache2/httpd.conf
LoadModule php5_module libexec/apache2/libphp5.so
/usr/libexec/apache2/libphp5.so
/private/etc/php.ini
extension_dir = "/opt/local/lib/php/extensions/no-debug-non-zts-20090626"
Create a web page, with these contents:
<?php
phpinfo();
echo datefmt_create("en_US" ,IntlDateFormatter::FULL,IntlDateFormatter::FULL);
?>
(Yes, I know that 2nd line gives an error, but in this case it is enough to tell us it works.)
View that web page, and search for "Internationalization support" or "intl". In my case I see:
Internationalization support enabled
version 1.0.3
ICU version 4.2.1
Directive Local Value Master Value
intl.default_locale no value no value
intl.error_level 0 0
If you have no intl section present, then it can only be a php.ini issue (the more usual cause is not restarting apache, but you said you'd done that).
To confirm, edit the php.ini file again and at the very end introduce a change you can be sure will work. E.g. asp_tags = 1. Now reload your phpinfo() page and make sure you see the change there.
If you don't perhaps it is permissions; the user Apache runs as cannot read your php.ini file?

Increase var_display_max_depth for xdebug

I recently installed xdebug on my ststem and wanted to increase xdebug.var_display_max_depth from 3 to 10. How can I go about doing that?
There are two ways to do that. You can edit this value locally and globally too.
Local setting ("Local value") in your own PHP file:
<?php
ini_set('xdebug.var_display_max_depth', '10');
// here comes your code...
?>
Global setting ("Master value") in php.ini:
First locate your php.ini file.
In phpinfo(), you can get to know where it is from "Loaded Configuration File" directive.
You can also locate it using command prompt/terminal:
Windows: php --ini | findstr /C:"Loaded Configuration File"
Linux/UNIX-like: php --ini | grep 'Loaded Configuration File'
using php_ini_loaded_file(): <?php echo php_ini_loaded_file(); ?>
Open your php.ini in a text editor file.
You have to put something like the following to this file (in this example, I'm using php_xdebug-2.2.3-5.3-vc9-nts.dll (use http://xdebug.org/wizard.php to get to know which version you need)), and of course, you need to substitute <path to your XDebug> to the appropriate path:
[Xdebug]
;; <path to your XDebug> is like
;; C:\Program Files (x86)\PHP\v5.3\ext in Windows
;; (should be e.g. in PHP directory's "ext" subdir)
;; [backslash UNDER WINDOWS, / under UNIX-like operating systems]
zend_extension = "<path to your XDebug>\php_xdebug-2.2.3-5.3-vc9-nts.dll"
;; HERE comes the answer to your question, we set the mentioned variable to 10
xdebug.var_display_max_depth = 10
Simple as that... you can check the results in phpinfo's xdebug part in a table: there will be a "Local value" and a "Master value" column.
Here's a sample screenshot from my localhost server; in this example, the global configuration is 3, but I set the local value to 10, with the above mentioned ini_set():
In addition to Sk8erPeter answer you can of course set it in your .htaccess file for faster management:
php_value xdebug.var_display_max_depth 10

webgrind on wamp

I just installed wamp and the latest version comes with webgrind, but i cannot figure out how it works.It says
Select a cachegrind file above
And thats all.
Webgrind is a parser/viewer for a profiling file format called cachegrind. The PHP extension Xdebug can (among other very useful things) generate these. For webgrind to work, Xdebug needs to be installed and enabled.
Make sure Xdebug is installed and working (see the Xdebug docs for info on how to do that)
Have Xdebug generate a profiling report by requesting a local PHP file
Load webgrind in the browser and select a file in the popup-menu at the top
Press update, and hopefully everything should work
The wiki on Google Code has more on configuring webgrind.
1) Download XDebug from their download page.
2) Put all DLL files in your PHP extension directory: C:\wamp\bin\php\php5.x.x\ext
3) Add the following line in your php.ini file located in C:\wamp\bin\php\php5.x.x:
zend_extension = c:\wamp\bin\php\php5.3.0\ext\php_xdebug-2.1.0-5.3-vc6.dll
4) Add also the following section to your php.ini (search for the [xdebug] section first to make sure it does not exist yet):
[xdebug]
xdebug.profiler_enable = 1
xdebug.profiler_output_dir = "c:\wamp\www\webgrind\tmp"
xdebug.profiler_output_name = cachegrind.out.%t.%p
5) Restart Wamp and verify that the extension was loaded. To do so, add a file pi.php in C:\wamp\www\ and put the following code in it:
<?php
phpinfo();
?>
6) Check the output by opening your browser at http://localhost/pi.php and search for XDebug.
7) Download Webgrind from their download page and extract in in your www folder.
8) Edit the config.phpfile located in C:\wamp\www\webgrind\ to change the storage directories:
static $storageDir = 'c:\wamp\www\webgrind\tmp';
static $profilerDir = 'c:\wamp\www\webgrind\tmp';
9) In the Webgrind directory where you have extracted the code, add an .htaccess file and put this content in it to avoid webgrind from profiling itself:
php_flag xdebug.profiler_enable 0
10) Rerun the http://localhost/pi.php script to generate some profiling data.
11) Open your browser with http://localhost/webgrind to display the results. Do not forget to click the Update button!
This answer is based on an answer provided by Jacob Moen. You can view the original source here.
It is good to watch if the application becomes SLOW, had problems with
it because of the settings of Cachegrind.
Good luck!
My settings are Wamp 2.4, Apache 2.4, PHP 5.4 and MySQL 5.6
[Portugues pt_BR]
É bom prestar atenção se a aplicação se tornar LENTA, tive problemas com isso por causa das configurações do cachegrind.
Boa sorte!
Minhas configurações são Wamp 2.4, Apache 2.4, PHP 5.4 e MySQL 5.6
Update the PHP.INI with these parameters
xdebug.profiler_enable = 1
xdebug.profiler_enable_trigger = 1
RESTART ALL SERVICES
this should be work.
You don't have to do much....
I just edited the line to be
xdebug.profiler_enable = 1
Thats all buddy. Totally works!

Categories