What does "XDEBUG NOT LOADED AS ZEND EXTENSION" warning means? - php

Xdebug is loaded, but not loaded as a zend extension. What does it mean? How to resolve this problem?

This error means that you used "extension=" to load Xdebug. That could be in your normal php.ini, or in a file called xdebug.ini that some distributions like to add. In any case, Xdebug needs to be loaded as a Zend extension for certain features such as single step debugging. As Xdebug is not meant to work as a normal extension, it might crash and burn too.
The syntax for loading Xdebug as Zend extension depends on PHP version and build. I would suggest you use http://xdebug.org/wizard.php to provide you with the correct lines.

Make sure if it is configured to load correctly as a zend_extension. Inside php.ini add this line
zend_extension="/usr/local/php/modules/xdebug.so"

Others have already explained that the error is because Xdebug is being loaded as a regular PHP module instead of as a Zend extension. You can use the wizard that Derick linked to or manually enter the line as Starx showed.
However, there is an issue that you may run into. The extensions_dir directive in php.ini currently only applies to PHP modules, not to Zend extensions. Therefore, you cannot use a common configuration like this:
[PHP]
extension_dir = .\ext
extension = php_memcache.dll
…
[zend]
zend_extension = php_xdebug-2.2.3-5.3-vc9-nts.dll
While PHP will correctly load php_memcache.dll from the ext sub-directory, it will not load php_xdebug-2.2.3-5.3-vc9-nts.dll and will throw the error Failed loading php_xdebug-2.2.3-5.3-vc9-nts.dll.
To fix this, you will need to either use an fully-qualified/absolute path such as:
zend_extension = C:\foobar\PHP\ext\php_xdebug-2.2.3-5.3-vc9-nts.dll
or a relative path such as these:
zend_extension = ext\php_xdebug-2.2.3-5.3-vc9-nts.dll
zend_extension = ..\phpexts\php_xdebug-2.2.3-5.3-vc9-nts.dll
zend_extension = \dev\phpexts\php_xdebug-2.2.3-5.3-vc9-nts.dll
(The wizard will return zend_extension=.\ext\php_xdebug-2.2.3-5.3-vc9-nts.dll which includes the directory but also a superfluous .\)

If you want to activate zend*nts*.dll into you php.ini file on Windows servers, you must use zend_extension_ts directive instead of zend_extension
Example to load xdebug :
[XDeug]
zend_extension_ts="DRIVE:/PATH_TO_XDEBUG/php_xdebug.dll"
xdebug.show_local_vars=1
xdebug.default_enable=On
Note : the double quotes to your dll file
Hope that will helps someone :)

First of all In PHP 5.3 and later, you need to use only zend_extension, not zend_extension_ts, zend_extension_debug, or extension.
The php.ini file should look like this
[xdebug]
zend_extension="C:\xampp\php\ext\php_xdebug-3.2.0RC2-8.1-vs16-x86_64.dll"
xdebug.mode=debug
xdebug.client_host=127.0.0.1
Attention!! to avoid errors you need to install the correct xdebug library file.
For example, assuming you using windows and install this xamp version xampp-windows-x64-8.1.10-0-VS16-installer. The valid .dll xdebug file would be PHP 8.1 VS16 TS (64 bit) to download.
Do all the above and i guarantee no loading errors or problems

If you end up here while trying to build xdebug, then it means you have built it as a "static" extension (not a zend one).
You can use configure --with-xdebug=shared to build it as a shared extension (dll/so; you should see a table showing that xdebug is now configured to be built as a shared extension instead of a static one) so it can be loaded as a zend extension afterward.
I don't know if you can make a static zend extension.
Also, note that running the full test suite of xdebug requires to not activate opcache (configure --disable-opcache --with-xdebug=shared)

Worked for me: in php.ini
zend_extension = php_xdebug-3.0.4-8.0-vs16-x86_64.dll

Related

Can you believe php -m says yes and phpinfo() says no?

This is my php.ini
extension_dir = "ext"
extension=php_tidy.dll
[Tidy]
;tidy.default_config = /usr/local/lib/php/default.tcfg
tidy.clean_output = Off
Can you belive when I type php -m, I get tidy in the list but when I check the phpinfo() function, there is no mention about tidy ?
And when I write $tidy = new tidy; in a php file, I get this error Fatal error: Class 'tidy' not found in E:\DEV\WWW\lexique\load.php on line 32. (The application worked fine under a previous install)
PHP 5.4.15
Apache 2.4
CLI and Apache environments use seperate php.ini configs. As such they separately define the extensions they use.
php_tidy will have to be enabled on both configurations to work.
This depends on your setup however. I am using a Ubuntu install as an example which typically contains both directories /etc/php5/apache2 and /etc/php5/cli, each containing their own php.ini file.
The extensions themselves however are usually shared, so you shouldn't need to install them twice.
I have resolved it adding the PHP folder to the PATH and restarting the computer.

How to add XDebug zend_extension to php.ini?

I have a VPS with cPanel WHM and am trying to enable XDebug. I installed the extension by going to WHM -> Software -> Module Installers -> PHP Pecl -> Manage and I confirmed it's installed by checking my phpinfo() page.
The next step is to enable XDebug in my php.ini file, but I'm a little confused how I should go about doing this.
Looking at php.ini in /usr/local/lib, I see this line at the bottom:
zend_extension="/usr/local/Zend/lib/Guard-6.0.0/php-5.4.x/ZendGuardLoader.so"
However, in WHM -> Service Configuration -> PHP Configuration Editor, there's a "zend_extension" option with this value:
/usr/local/IonCube/ioncube_loader_lin_5.4.so, /usr/local/Zend/lib/Guard-6.0.0/php-5.4.x/ZendGuardLoader.so
So my question is, how should I go about adding the path to XDebug:
/usr/local/lib/php/extensions/no-debug-non-zts-20100525/xdebug.so
To php.ini? I see three ways of doing it and I don't know which is correct:
I could add it to the comma separated list in WHM
I could add it in php.ini directly, putting a comma between it and the existing value
I could put it on a new line in php.ini
Which way is correct?
Highly depends on the PHP configuration (./configure). PHP will look in the default extension path for your xdebug.so extension; in which case you don't need to specify any path:
zend_extension = xdebug.so
Regarding new line and comma, I prefer new line because it makes it easier to remove an extension later on. My php.ini looks like this (example):
extension = memcached.so
extension = zopfli.so
zend_extension = opcache.so
zend_extension = xdebug.so
Notice the alphabetical order as well.
You can add at the bottom of the file like the following:
zend_extension="/absolute/path/to/xdebug.so"
In my case, i put it in
zend_extension = /usr/lib64/php/modules/xdebug.so
However
If you want to use Xdebug and OPCache together, you must have the zend_extension line for Xdebug after the line for OPCache. Otherwise, they won't work properly.
See: https://xdebug.org/docs/install

Zend Debugger Extension Is Not Loading Correctly

I'm on windows 7 with PHP 5.4.4 TS. I'm trying to load the zend debugger extension, it's the last line on my PHP.ini file:
[Zend]
zend_extension_ts = C:\php\ext\ZendDebugger.dll
zend_debugger.allow_hosts = 127.0.0.1/32,192.168.0.1/32,10.0.0.0/8
zend_debugger.expose_remotely = always
The extension doesn't show up when I call the phpinfo() section. There is nothing in the error logs though. The extension that I am using is for PHP 5.3 though so that may be why it's not loading properly. Does anyone know if there is a TS version for PHP 5.3+ ?
I had the same problem with PHP 5.4.11. It looks like thread safe versions of ZendDebugger.dll are no longer available. Using zend_extension (instead of zend_extension_ts) with ZendDebugger.dll for 5.3.x (max version I could find) did not work for me either.
In the end I solved the problem by switching to xdebug from xdebug.org. Downloaded php_xdebug-2.2.1-5.4-vc9.dll from http://xdebug.org/download.php and adjusted php.ini as:
zend_extension="C:\php_5_4_11\ext\php_xdebug-2.2.1-5.4-vc9.dll"
zend_debugger.expose_remotely=always
xdebug.remote_enable=on
xebug.remote_handler=dbgp
xdebug.remote_host=localhost
xdebug.remote_port=9000

PHP Zend Debugger configuration

Hi i am new to php, I currently learning php using eclipse. I know i have to install the zend debugger my php.ini store at c:windows i had added in these line:
[Zend]
zend_extension=c:/php/ext/ZendDebugger.dll
zend_debugger.allow_hosts=127.0.0.1
zend_debugger.expose_remotely=always
zend_debugger.connector_port=10013
but on command prompt i tried php -m it shown that i never install zend debugger. I not sure where goes wrong I check phpinfo also never show any zend information.
I had lots of problems making the debugger work. Now I'm using the ZendServer CE which is free and the configuration is a lot easier.
Also I use Eclipse + PDT, downloaded from Zend Site.
This should work right out of the box. Why not using ZendServer? you get everything you want in a package.
On a browser go to:
http://localhost/?phpinfo=1
look for "Loaded Configuration File"
and take a note of the path
Now open a DOS prompt window (Start > Run > (type) cmd)
and at the command line type
c:\path\to\your\php\php.exe -r phpinfo(); |more
(press CTRL+C to break)
Again look for:
"Loaded Configuration File"
and take a note of this path.
It could be that you are using a different php.ini for your webserver and for the CLI version.
You will need to add the config changes to both php.ini files or put the config in a file called zend.ini and place that in the folder that is mentioned in your phpinfo output under:
"Scan this dir for additional .ini files"
I have experienced the same thing when I was using thread-safe PHP on Windows.
Up to date versions of the Zend Debugger no longer support running in thread-safe flavors of PHP on Windows. Switching to a non-thread-safe (a.k.a nts) flavor of PHP fixed this issue for me.
See here: http://forums.zend.com/viewtopic.php?f=59&t=1918#p13729

mysql is not enabled in phpinfo() of php 5.3.1

I am having apache 2.2.14, php 5.3.1 and mysql 5.1.43 installed on vista. I am trying since 2 days to configure php to have mysql enable on phpinfo().
I modified php.ini to have extension_dir = "c:\php\ext"
modified the extension as extension="php_mysql.dll"
added "c:\php" to the "PATH" environment variable and restarted the vista.
after trying many combinations of putting php.ini, php_mysql.dll and libmysql.dll in c drive and/or c:/windows and/or c:/windows/system32 now I am with no options!!
I do restart the apache after each modification. I used libmysql.dll present in mysql installation and that of older php version as php 5.3.1 has no libmysql.dll...
Any help will be appreciated.
Thanks in advance.
You have to edit php.ini and add/uncomment a line to import the php_mysql.dll extention. Search for ;extention=php_mysql.dll and remove the ;. If you find this line without the ; in front of it, you have another problem. If you don't find this line, add it without the ;.
You can also try to put a \ after the extention path: extension_dir="c:\php\ext\"
put php_mysql.dll in the "c:\php\ext" directory (and keep the extension="php_mysql.dll" uncommented [without the leading ;])
Make sure you've edited the right php.ini. In case of doubt
<?php echo 'ini= "', get_cfg_var('cfg_file_path'), '"';
will tell you which one is used by your php installation.
Maybe php tried to load the php-mysql extension and failed because of additional dependencies. That would cause a startup error entry in the error.log.
Which php-build do you use? The php-mysql extension can either use libmysql.dll as transport layer or the new mysqlnd (MySQL native driver) module. You've added c:\php to PATH. That's usually done in order to let windows find libmysql.dll (though it's not necessary, there are other methods which I prefer). If php-mysql depends on libmysql.dll and windows can't find it loading php_mysql.dll will fail.
But if you're using the php.net build of php 5.3.1 the mysql module uses mysqlnd:
Installation on Windows
In the official PHP distributions from 5.3 onwards, MySQL Native Driver is enabled by defaultThis module is built-in in the php.net build. You can test that by calling php -m in a command shell. It prints all built-in modules.
Thanks a lot to the user who said that we have to move the file php.ini to the folder /bin of the Apache server. it resolves me the same problem after more than one week of trying failed methods.
Of course we must uncomment in the file the two lines;
;extension=php_mysql.dll
;extensin_dir="ext"
by removing the semi-colon (;) and by specifying the full path for the extension library php_mysql.dll rather than ext as follows
extension=php_mysql.dll
extensin_dir="c:\Apache22\php53\ext"
For me I installed Apache in the folder c:\Apache22 and PHP in the folder c:\Apache22\php53, you must use your own values.
NOTE: Because mysql_ functions like mysql_connect() become deprecated in PHP 5.5 and above, it is recommended to enable also the library php_mysqli.dll to use functions like mysqli_ (improved version of mysql_ functions). To do that it is simple, you just have to uncomment the line:
;extension=php_mysqli.dll
in the file PHP.ini as follows:
extension=php_mysqli.dll
Update April 7, 2013. Installed Windows 8 on an i7 Quad, HT 8, 3.62GHz, 12GBRAM.. Installed the latest version of MySQL, got it functioning properly. Installed the latest version of Apache Web Server, got it functioning properly. Installed the latest version of PHP, got it functioning properly. MySQL could not connect to the database. The error message was "mysql_connect function undefined". I copied the modified php.ini file into the "C:\Program Files (x86)\Apache Software Foundation\Apache2.2\bin", and restarted Apache web server... then it all magically started working.!!! I hope this helps somebody with setting up their own Windows MySQL / PHP web server.

Categories