How to add XDebug zend_extension to php.ini? - php

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

Related

missing php intl & xsl extensions while installing Magento 2 on readiness check point

I'm trying to run the Magento installer on Windows 7 with MAMP 3.3.0 . When I do that Readiness Check says to me that: xsl & intl extension is missing.
I have both dll in the /ext dir .
I have two php.ini files in conf\php7.0.13\ dir : php.ini-development & php.ini-production. I already uncomment the xsl and intl in the both php.ini files.
Copied icu***.dll from php to apache bin folder too but still gets the same
error.
Help me, please. If I have not clearly explained, what information is needed to solve the problem?
What could the issue be?
I suppose you're trying to make it run on Windows otherwise there is no meaning in using .dll files.
Before starting the configuration of the Magento drop a file in that configuration with
phpinfo();
and get the exact location of the used php.ini file so you'll be sure there's not a 3rd one.
Uncomment and check the location of the extensions.
Please edit php.ini in the php installed folder usually present in /etc/php
old code
...
;extension=php_intl.dll
...
...
;extension=php_xsl.dll
new code
...
extension=php_intl.dll
...
...
extension=php_xsl.dll
save and restart your apache.
IN xamp/php/php.ini search and modify php.ini file and search (;extension=php_xsl.dll) line and remove ; before line start same as remove ; before (;extension=php_intl.dll) in php.ini and save php.ini file.and open xamp manager and stop apache servises and restart again.

php xsl extension missing magento readiness check

I'm trying to install magento on my Windows 10 system with MAMP PRO, and I have been getting the same error over and over for a while now. The magento installer says that my php xsl extension is missing. To install the extension, the manual says that I have to add the argument --with-xsl[=DIR] to my configure line but I have no idea how to do this.
I have added extension=php_xsl.dll to my php.ini file but it still isn't added. The php_xsl.dll is present in my /ext folder.
What could the issue be?
Uncomment the following line from php.ini file(remove ';' from the line)..
;extension=php_xsl.dll
in xamp/php/php.ini search and modify php.ini file, search ;extension=php_xsl.dll line, remove ; at the line start and save php.ini file. Then open xampp manager, stop Apache services and restart again.
This is because the XSL extension is not enabled.
To enable the XSL extension go to the location where the MAMP (or XAMPP) is installed. Then go to php/php.ini.
Un-comment the line extension=php_xsl.dll and restart the server.
Go to php.ini file
Change ;extension=xsl to extension=xsl
Restart your Apache xampp
First, stop apache.
Edit C:\xampp\php\php.ini
Only remove ; at the begiinning of the line extension=php_xsl.dll
Then start apache again
It will work proper.
You can solve this error simply by following these easy steps.
Stop the Apache server first
Then go to C:\xampp\php
Open php.ini file
Then uncomment all required extensions (;extension=xsl to extension=xsl)
Save it and exit
Then start xampp again and try to install
After what seemed like a million frustrating attempts, I finally came across this page and the note above. For some reason, the php.ini file in my MampPro php 7.0.9 was missing the intl and xsl dll (even though I kept uncommenting the ";"
Anyway - I saw the note above and was able to make the amends -- and voila, the issue was resolved.
I wish somehow this info was made available in php documentation and in MampPro site too. Hopefully, this won't be an issue in future patches or updates.
Go to your php root folder,
Copy all icu* * * *.dll files:
from C:\xampp\php
to C:\xampp\apache\bin
Are your other ext you've loaded in php.ini working nomarlly ?.(Try php_info())
And did you think u've download correctly .dll file.
I was installing Magento 2.1 on MAMP PRO WINDOWS (something that is not supported and not done) as a total newbie.
The same problem popped up intl en xsl extensions missing while ; was removed.
After trying everything I just looked at the php.ini location phpinfo()
C:\Users\Public\Documents\Appsolute\MAMPPRO\conf\php7.0.6.ini
Copied the php7.0.6.ini I changed on several locations an many times just into this windows directory and all my troubles were gone.
Magento is often installed on Linux. The title of this question above doesn't specify the server but the question does so I stumbled on this answer though I was looking for the Linux solution. So if anyone is looking for how to enable the xsl extension on Ubuntu, the answer is here: Enable XSL on Ubuntu 12.04
Search for php.ini in php fold and remove ; from ;extension=php_xsl.dll and you are good to go
The most upvoted answers are not telling you where to go to edit these files.
The correct path is: C:\MAMPPRO\conf\php(version number here)
Then you can remove the ; from the line extension=php_xsl.dll and restart the server.
In Installer.php line 545 error in magento 2.4.1
uncomment the following in your php.ini file by removing ";" for
;extension=intl
;extension=soap
;extension=xsl
;extension=sockets

You must enable the openssl extension to download files via https

I wanted to install Zend Framework 2. So I downloaded the skeleton application. As mentioned in the ZF2 manual, we have to issue the command
php composer.phar install
Inside the skeleton.
But I'm getting an error
You must enable the openssl extension to download files via https
Then I enabled the ssl_module in my wamp, I checked the php_ini file and I can see the following line
extension=php_openssl.dll
Still I'm getting the same error. Anybody having any clue what I missed out?
PHP CLI SAPI is using different php.ini than CGI or Apache module.
Find line ;extension=php_openssl.dll in wamp/bin/php/php#.#.##/php.ini
and uncomment it by removing the semicolon (;) from the beginning of the line.
Verify you are editing the correct php.ini file.
Reference:
https://github.com/composer/composer/issues/1440
"WAMP uses different php.ini files in the CLI and for Apache. when you enable php_openssl through the WAMP UI, you enable it for Apache, not for the CLI.
You need to modify C:\wamp\bin\php\php-X.Y.Z\php.ini to enable it for the CLI."
make sure you have correct path to extension folder
extension_dir = "ext"
by default it is commented with ; character
I also had the same issue while playing around Zend Framework 2 and composer. I'm using PHP 5.4 (installed via macports) and my solution was to install openssl for PHP 5.4 via macports as well.
sudo port install php54-openssl
I have faced this problem, but configuging openssl (also for cli) did not help.
I have updated composer and this sloved my problem.
Just type:
$ php composer.phar self-update
or
$ composer selfupdate
Good luck!
I use XAMPP. In C:\xampp\php\php.ini, the entry for openssl did not exist, so I added "extension=php_openssl.dll" on line 989, and composer worked.
You need to enable "extension=php_openssl.dll" in both files (php and apache). my pc files path are these :
C:\wamp\bin\php\php5.3.13\php.ini
C:\wamp\bin\apache\apache2.2.22\bin\php.ini
Uttam, if your issue is not solved then try the follwoing 3 step approach. It worked for me as I had exactly same issue.
step1: click on wamp tray icon.
step2: goto menu apache->apache modules
step3: click on menu item "ssl_module"
it will automatically restart wamp. if wamp not restarted automatically then restart it through wamp tray menu-> Restart All services. After restart confirm that "ssl_module" coming as ticked under menu apache->apache modules
after that just attempt the php composer.phar install
from going through the response shared by you, php.ini file contains extension=php_openssl.dll and the php/ext directory also have file "php_openssl.dll"
good luck
The Valery's answer helped me:
https://stackoverflow.com/a/14265815/492457
WAMP uses different php.ini files in the CLI and for Apache. when you
enable php_openssl through the WAMP UI, you enable it for Apache, not
for the CLI. You need to modify C:\wamp\bin\php\php-5.4.3\php.ini to
enable it for the CLI.
Make sure that you update your php.ini for CLI. For my case this was C:\wamp\bin\php\php5.4.3\php.ini and uncomment extension=php_openssl.dll line.
Late answer but adding so other can learn the reason.
You also need to edit the php.ini file in the "wamp\bin\php\php-X.Y.Z" location.
I had to uncomment extension=openssl in php.ini file for everything to work!
Becareful if you are using wamp don't use the wamp ui to enable the extension=php_openssl.dll
just go to your php directory , for example : C:\wamp\bin\php\php5.4.12 and edit the php.ini and uncomment the extension=php_openssl.dll.
it should work.
Was facing this error
"You must enable the openssl extension in your php.ini to load
information from.."
I solved by finding and uncommenting the following lines on php.ini file
;extension=php_openssl
;extension_dir = "/c:\wamp64\bin\php\php 8.0.25\ext\/"
;extension=bz2
;extension=curl
;extension=fileinfo
;extension=gd
;extension=gettext
;extension=gmp
;extension=intl
;extension=imap
;extension=ldap
;extension=mbstring
;extension=exif
;extension=pdo_sqlite
;extension=shmop
in
Wamp/bin/php/php 8.0.25/php.ini
Uncomment both by removing the semicolon (;) from the beginning of each line.
If you have the latest PHP v^8 or above, likely you won't see php.ini file. So what you do is to make a copy of php.ini-development which you will see there and then rename the copy you just made to php.ini and then do the same uncommenting of the two lines then save.

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

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

Enabling the OpenSSL in XAMPP

I spent three hours but I did not find anything; I'm unable to connect to a SSL enabled server. I want to list what i did:
First checked my PHP extensions directory was in order; extension wasn't there, php_openssl.dll
Then I opened my php.ini file but I could not see any extension=php_openssl.dll line to uncomment.
Also, I searched on Google and saw people with the same problem.
http://www.apachefriends.org/f/viewtopic.php?p=162623
However, I also have
OPENSSL_CONF C:/xampp/apache/bin/openssl.cnf
...
openssl
OpenSSL support enabled
OpenSSL Library Version OpenSSL 0.9.8l 5 Nov 2009
OpenSSL Header Version OpenSSL 0.9.8l 5 Nov 2009
no lines . What should I do? Please share your suggestions.
Yes, you must open php.ini and remove the semicolon to:
;extension=php_openssl.dll
If you don't have that line, check that you have the file (In my PC is on D:\xampp\php\ext) and add this to php.ini in the "Dynamic Extensions" section:
extension=php_openssl.dll
[PHP_OPENSSL]
extension=php_openssl.dll
This is the answer.
Things have changed for PHP > 7. This is what i had to do for PHP 7.2.
Step: 1: Uncomment extension=openssl
Step: 2: Uncomment extension_dir = "ext"
Step: 3: Restart xampp.
Done.
Explanation: ( From php.ini )
If you wish to have an extension loaded automatically, use the following syntax:
extension=modulename
Note : The syntax used in previous PHP versions (extension=<ext>.so and extension='php_<ext>.dll) is supported for legacy reasons and may be deprecated in a future PHP major version. So, when it is possible, please move to the new (extension=<ext>) syntax.
Special Note: Be sure to appropriately set the extension_dir directive.
So, what did we do to make openssl_pkey_new() and all the other openssl_ functions in PHP work...
Enabled the extension php_openssl.dll in the (right/active) php.ini. Checked.
Checked that there exists a openssl.cnf in xampp\apache\conf\ (and also in two other directories within XAMPP). Checked.
Added the environment variable OPENSSL_CONF in the Windows system settings with the full path to the above openssl.cnf. Checked.
Restarted Apache (and after that did not work restarted the computer several times...). Checked.
Still does not work, and throwing errors such as
error:0E06D06C:configuration file routines:NCONF_get_string:no value
error:02001002:system library:fopen:No such file or directory
error:2006D080:BIO routines:BIO_new_file:no such file
Okay, here are another two more things to check.
1. Trouble with the environment
Run phpinfo() from a PHP script, and go to the "Apache Environment" section. Check the value of OPENSSL_CONF.
Surprise. This is not what we have set in the windows system settings.
The solution is simple. Set the environment variable in the PHP script.
putenv('OPENSSL_CONF=C:\xampp\apache\conf\openssl.cnf');
2. Trouble with relative filenames
Now, openssl_pkey_new() will work, but openssl_pkey_export_to_file() does still not work and returns false without any further explanation?
Check the filename that you have specified as output filename. It will not work in Windows as long as you do not specify the full path.
$folder = realpath('../keyring');
$outfile = $folder.'/private.pem';
openssl_pkey_export_to_file($key, $outfile);
I use xampp. Beforehand I tried the example file "test_smtp_gmail_basic.php" in phpMailer (you can download phpMailer here: https://github.com/Synchro/PHPMailer), but I got the following error:
Mailer Error: The following From address failed: xxx#gmail.com
After I commented out ; extension=php_openssl.dll in php.ini, it is working now.
In xampp, if "extension=php_openssl.dll" is not present in your php.ini file then add it in the "Windows Extensions" section of your php.ini file
and restart your apache.
It works for me..
You will need to edit your php.ini. It's 4 easy steps.
Find your php.ini file.
$inipath = php_ini_loaded_file();
Enable openssl in the file:
extension=php_openssl.dll
Turn allow_url_fopen on
allow_url_fopen = On
Restart apache and you are done!
STEP 1: On your php.ini comment out ;extension=php_openssl.dll
STEP 2: Copy libeay32.dll and ssleay32.dll from your PHP root folder and paste it your Apache/bin folder
STEP 3: Restart Apache
I am assuming that this question is for those using a windows based system.
After making sure that the extension extension=php_openssl.dll in your php.ini file does not have a semicolon.
Then make sure that you have added C:/xampp/apache/bin into your environment path in order to use openssl without having move the command prompt to that directory C:/xampp/apache/bin
Although not related to this question but as the WP migrate Pro docs link to this question I though I would post an answer here.
If your having problems with DB Migrate Pro activating instead of enabling SSL you can just add a line of code to your wp-config
define( 'WPMDB_LICENCE', 'XXXXXXXXXXx' );

Categories