I have added following lines into php.ini
[XDebug]
zend_extension = C:\PROGRA~1\PHP5\ext\php_xdebug-2.1.0-5.3-vc9.dll
xdebug.remote_enable=on
xdebug.remote_handler=dbgp
xdebug.remote_host=localhost
xdebug.remote_port=9000
Version of php_xdebug-2.1.0-5.3-vc9.dll is obtained via page http://www.xdebug.org/find-binary.php.
But there are no any mentions of 'xdebug' string in output of phpinfo().
What can be wrong?
(This is my second fight with php-xdebug to get working, first time I gave up. If you have other suggestions concerning debugging please add them also, possibly as comments to the question. I would like to following scenario work under windows: "Set up break point, run my script, it stops on break point and I can see the value of some variable". Thanks)
UPDATE
Restart of Apache does not resolve the issue.
In log file the message appears:
Apache/2.2.14 (Win32) PHP/5.3.1 configured - resuming normal operations
check the top of the output of
php -m
for me it showed an error in php.ini, after solving that xdebug was loaded.
zend_extension = C:\PROGRA~1\PHP5\ext\php_xdebug-2.1.0-5.3-vc9.dll
should be replaced by
zend_extension="C:\PROGRA~1\PHP5\ext\php_xdebug-2.1.0-5.3-vc9.dll"
P.S. Will e-mail xdebug guys.
This worked for me (vscode, xampp)
Go to https://xdebug.org/wizard.php and paste the contents of phpinfo()
Then download the right xdebug.dll and place it in your 'ext' folder.
Add the following to your php.ini
[XDebug]
zend_extension="php_xdebug-2.5.4-7.0-vc14.dll"
xdebug.remote_enable=1
xdebug.remote_autostart=1
I just had the same problem, nothing of this worked for me.
I started php in the console and I saw, php was unable to load the dll from the given path.
The solution for me was to omit the path information and only load it like this:
zend_extension="php_xdebug-2.2.5-5.5-vc11.dll"
You can follow this tutorial on getting started with xdebug : http://devzone.zend.com/article/2803-Introducing-xdebug
Xdebug and ZendDebug are two separate debuggers, it's up to you to decide which one to use. Either one is pretty easy to setup. Only a couple of steps in Eclipse.
Post the content from your php info page into this page to find out which version to download : http://www.xdebug.org/find-binary.php
I was just struggling with this myself and found a way to identify (and solve) the problem. It works on Xampp and Windows 7 at least.
In my case the problem was dots. Renaming "php_xdebug-2.2.5-5.5-vc11.dll" to "php_xdebug.dll" did the job.
Another pro-tip is that newer versions of Xampp have Xdebug built-in, so you don't need to donwload it, just edit php.ini with:
zend_extension = "path\to\php\ext\php_xdebug.dll"
xdebug.remote_enable = on
xdebug.remote_handler = dbgp
xdebug.remote_host = 127.0.0.1 (or localhost)
xdebug.remote_port = 9000
xdebug.remote_mode = req
Then restart the apache and it should work. The advantage of using xampp built-in xdebug is that it's most likely the right version.
Writing in January 2019, I found that following the Xdebug Wizard at Xdebug wizard here
exactly, including using their download link to the correct version of Xdebug for your version of PHP and copying the line to insert on your php ini exactly as is, got Xdebug appearing in phpInfo for me. I was installing into Laragon . Running php -m from the command line gave a good confirmation of all being well, with Xdebug loading as a Zend Extension. Usual gotchas about needing to restart server etc apply.
In my case, Xdebug is showing in php -m, php -i but not in phpinfo() result.
Restarting Apache didn't help until restarting php-fpm
systemctl restart php-fpm.service
Its happen because of permission.
you have to add the permission of that specific app/user profile from the folder's Properties Security tab.
I use PHP with IIS server so.
It worked for me by adding IIS_USER in security permission.
in my case the issue was the php.symlink file in the C:\wamp64\bin\apache\apache2.4.23\bin folder , this file links to the php.ini file existed in C:\wamp64\bin\php\php5.6.25 but apparently it wasn't working so i've deleted it and copy paste the actual php.ini to the same folder and it worked.
if you want to return the php.symlink back open cmd in the
C:\wamp64\bin\apache\apache2.4.23\bin and write the following (windows):
mklink php.ini C:\wamp64\bin\php\php5.6.25\php.ini
replace the path to point to your php.ini inside your php file
Just for the newbees:
If you want to check if the .dll, specified in the php.ini is loading properly:
Add php to the Windows Runtime Directory. For win10, refer to this post https://www.forevolve.com/en/articles/2016/10/27/how-to-add-your-php-runtime-directory-to-your-windows-10-path-environment-variable/
From the Windows command prompt, type php -m and check if any error is displayed.
In my case the issue was the file path which apache loaded, the file php.ini I changed is not the current loaded config, so check it First.
xdebug appears in "php -m" command line BUT nothing on the browser <?php phpinfo(); page !
Check in httpd.conf PHPIniDir "C:/to/the/RIGHT/phpversion"
The command line php.exe use the Environment PATH variable but nut the apache !
Related
I can't get my PhpStorm IDE to work with xdebug.
My current setup is the following:
PhpStorm 2017.1.4
MacOS Sierra 10.12.5
Here are the steps that I followed.
I have installed php with the following command. I have added the postgres parameter because I need it later to connect to a PostgreSQL database.
brew install php71 --with-postgresql
The next step is to install XDebug with the following command
brew install php71-xdebug
So the next step that I got from the documentation (https://www.jetbrains.com/help/phpstorm/configuring-xdebug.html) is to edit the php.ini file with the following content:
[Xdebug]
zend_extension="<path to php_xdebug.dll>"
xdebug.remote_enable=1
xdebug.remote_port="<the port for Xdebug to listen to>" (the default port is 9000)
xdebug.profiler_enable=1
xdebug.profiler_output_dir="<AMP home\tmp>"
Just some questions about those fields and XDebug.
So I guess XDebug is some kind of service that runs on the remote_port and that PhpStorm is using to write data to? Or do you have to specify the port where the application you want to test is running?
What exactly is the profiler thing? And can the output dir be anything I can choose?
So this is my php.ini file that I think it should be:
[xdebug]
zend_extension="/usr/local/Cellar/php71-xdebug/2.5.4/xdebug.so"
xdebug.remote_enable=1
xdebug.remote_host=localhost
xdebug.remote_port=9000
xdebug.profiler_enable=1
xdebug.profiler_output_dir="/usr/tmp"
That's it for the php.ini. So I have to check the settings in my PhpStorm IDE. And those are the following:
So that is my setup. In my project I just have one index.php with <?php echo phpinfo(); ?> I just click the Chrome icon so it opens directly in the browser to check if XDebug is there. I see the following result.
So I thought to myself ok let's try some debugging. So I changed my index.php file to the following
$i = 2;
$j = $i + 2;
echo $j
I've put a breakpoint on the 2nd line. And when I run it, it never stops at the breakpoint. What is needed to do that or am I wrong in my configuration somewhere?
To make Xdebug remote debugging working on your page, you need to set a cookie in your browser, telling the server you want to debug the page, there are many extensions for that, the most known is Xdebug helper in Chrome.
I also suggest you to follow this tutorial Zero-configuration debugging, it is very detailed and clear IMO.
If you still have problems i'll try to help you with pleasure :)
Unable to enable XDEBUG. Any help or check if it is enabled and not reflected? I am on PHP7 and am using Xdebug 2.4.0rc2. PHP.INI settings below:
[XDebug]
zend_extension="C:/php/ext/php_xdebug.dll"
xdebug.remote_enable = on
xdebug.remote_host = localhost
xdebug.remote_port = 10000
xdebug.remote_handler = dbgp
xdebug.profiler_enable = 1
xdebug.profiler_enable_trigger = 1
xdebug.profiler_output_dir = "profilerlogs"
xdebug.profiler_output_name = cachegrind.out.%p
Unable to get it enabled. The steps are right but doesnt show up installed in phpinfo() as well.
I had same problem with XAMPP PHP7 now it's solved :)
There should be missing or wrong extention file in your C:/php/ext/ directory.
This will solve your problem.
Go to xDebug
Dowload Xdebug 2.4.0rc1 (PHP 7.0 VC14 TS 32/64)
Rename it to php_xdebug.dll
Paste this file in "php/ext" folder
Restart your server.
Now check your phpinfo()
In my case there were 64bit version so I've just changed to 32bit
Along with what #haider-lasani said please do not forget what type of PHP you are using. The latest XAMPP is using some really convoluted setup.
Go to your PHP folder and check whether you have php7.dll or php7ts.dll. If you have the latter version then you are supposed to pick up the TS version of xdebug.
Also check VC version as well.In this case it is VC14.
Now even though I am using a TS version of PHP I still have to add the plugin with zend_extension="C:/php/ext/php_xdebug.dll" and not zend_extension_ts="C:/php/ext/php_xdebug.dll"
TL;DR
While downloading xdebug make sure you:
Check x64/x86 bit version.(Use x86 xdebug just to be safe)
Check what version of PHP you are using.
Check whether you have TS or non-TS version of PHP by checking whether you have php{x}.dll or php{x}ts.dll.{x}is your php version.
Try switching between zend_extension and zend_extension_ts to include your xdebug plugin in your php.ini file to see what works.
Following all these steps should ideally fix your problems. Let me know if you still are facing any problems. Peace.
You shouldn't need to rename your DLL and it is a good idea not to, as it allows you to see what build of XDebug you have running.
Here is what I did and it works:
This answer assumes you have PHP set up with the correct PATH entry so that you can run PHP from the Command Line such as GitBash https://git-for-windows.github.io/
Open up your command line and enter this:
$ php -i
Scroll to the top and copy the output from the command line window beginning where you see
phpinfo()
..... copy contents until you see the last line which ends:
If you did not receive a copy of the PHP license, or have any
questions about PHP licensing, please contact license#php.net.
`
Go the XDebug Windows Wizard https://xdebug.org/wizard.php and paste your PHPInfo in the big text box and submit.
A new page will display with instructions and a "System Summary of your PHP. Carefully follow the instructions and select the Download link.
Once you have modified your PHP.ini and observed where your "ext" folder is, copy your downloaded XDebug dll file to "ext" folder.
Open your command line again and enter the following command:
$ php -m
If you have correctly followed the instructions you will see the output contains the following:
[Zend Modules]
Xdebug
Otherwise, you will see an error at the top of the console output such as:
Cannot load Xdebug
Usually, the errors occur because your XDebug:
is not in the correct location
is the wrong version
is incompatible because of thread type: Your PHP maybe Thread Safe, and your XDebug is Not Thread Safe (the XDebug Wizard will automatically choose the correct version)
If you are doing remote development on either a WSL or a Linux, check your php directory as you may need to modify php.ini files in the following locations:
/etc/php/7.2/apache2/php.ini
and
/etc/php/7.2/cli/php.ini
with
[XDebug]
xdebug.remote_enable = 1
xdebug.remote_autostart = 1
;don't forget to change the path and filename to the correct one
;but make sure you use the full path
zend_extension="/usr/local/php/modules/xdebug.so"
I installed Xampp like a week ago. It was already installed with a php_xdebug.dll file in the ext folder.
For me the solution was to specify the xdebug file like below, without a file path:
zend_extension = "php_xdebug.dll"
If you're on Windows 10 x64 running PHP 7.2 and Apache 2.4, Specifying DLL without the full path like this
zend_extension = php_xdebug-2.8.0-7.2-vc15-x86_64.dll
worked for me because my extension_dir = "ext" was set properly in php.ini.
Here is a detail set of instructions if you're using similar setup.
Edit: I've now removed the version of xdebug.so I installed manually, and installed XDebug via Homebrew. When I type "php -i" at the command line, xdebug appears to be installed; but when I run phpinfo(), there's still no sign of XDebug.
I've just got a new Mac so, like every time I buy a new Mac, I have rebuilt my local web development environment (this time, following an amazing tutorial: https://echo.co/blog/os-x-1010-yosemite-local-development-environment-apache-php-and-mysql-homebrew)
Everything has gone smoothly until I got to installing the XDebug extension. I use Komodo as a development environment so, as I've always done in the past, I followed the instructions here: http://docs.activestate.com/komodo/7.1/debugphp.html#debugphp_top
I followed the instructions to the letter, but I can't get xdebug.so to appear in my phpinfo.php() page. Here's what I did:
Created a phpinfo.php file so that I can find the correct php.ini file
Checked that phpinfo.php file and found that the "Loaded Configuration File" is "/usr/local/etc/php/5.6/php.ini"
Edited that php.ini, adding the following lines to the bottom of the file:
_
zend_extension=/usr/local/Cellar/php56/5.6.14/lib/php/extensions/no-debug-non-zts-20131226/xdebug.so
xdebug.remote_enable=1
xdebug.remote_handler=dbgp
xdebug.remote_mode=req
xdebug.remote_host=localhost
xdebug.remote_port=9000
xdebug.idekey=<idekey>
; You may also want this - to always start a remote debugging connection.
;xdebug.remote_autostart=1
Ran "brew services restart httpd22" (and, just to be sure, "sudo apachectl restart")
When I go reload phpinfo.php, it contains to reference to xdebug.so.
I can confirm that xdebug.so is present at /usr/local/Cellar/php56/5.6.14/lib/php/extensions/no-debug-non-zts-20131226 and that /usr/local/Cellar/php56/5.6.14/lib/php/extensions/no-debug-non-zts-20131226 is set as the "extension_dir" in php.ini.
What am I missing?!
Ultimately this proved be to be caused my me doing things in the wrong order. I'd used Homebrew to install Apache and PHP, but I'd installed Apache 2nd: this meant that it wasn't set up to work with the version of PHP I then installed.
I reinstalled PHP using the command brew reinstall php54 --homebrew-apxs, and that ensured that Apache and PHP were talking to each other.
Then, to install xdebug, I ran brew install homebrew/php/php56-xdebug. After restarting Apache, XDebug showed up in phpinfo() straight away!
Then I had to get XDebug talking to Komodo. To do this I added in the config lines from my original post to the specific xdebug config file that had been created during the Homebrew install (mine was located at /usr/local/etc/php/5.6/conf.d/ext-xdebug.ini), and then made sure that Komodo was listening on the correct port (9000 didn't work, so I changed to 9001).
I already uncommented in php.ini:
[PHP]
;;;;;;;;;;;;;;;;;;;
; About php.ini ;
;;;;;;;;;;;;;;;;;;;
;extension=php_oci8_11g.dll
extension=php_openssl.dll
;extension=php_pdo_firebird.dll
Variables of the system set ok.
PHP version 5.4.16:
C:\wamp\bin\php\php5.4.16\php.exe
Add to System path variable:
C:\ProgramData\ComposerSetup\bin
But, recive this error:
Some settings on your machine make Composer unable to work properly.
Make sure that you fix the issues listed below and run this script again:
The openssl extension is missing, which means that secure HTTPS transfers are
impossible. If possible you should enable it or recompile php with --with-openssl
I'm using:
windows 7
Wamp
php 5.1.16
apache 2.4.4
How solve this problem, please help me.
Open php.ini located in your "php" folder for example in xampp the file is in XYZ:\xampp\php\
Find "extension=php_openssl.dll"
";extension=php_openssl.dll" - remove ";"
Restart your xampp (or whatever u use), extension should be loaded after that.
Try agien to install composer.
ensure you are editing the php.ini locate on same place where is located php.exe, i was the same problem and wamp say the openssl is actived but Composer-Setup.exe used the php.ini in php directory/ext/ and wamp used C:\System...\php.ini,
Regards,
I have battled this several times. And this is the best solution I have found.
As mentioned, you need to ensure that extension=php_openssl.dll is enabled but doing just that sometimes may not resolve the error.
You should check that you have PHP on your path variable then see what INI file is loaded by typing php --ini in the console it should give you something like:
Configuration File (php.ini) Path: C:\WINDOWS
Loaded Configuration File: C:\WINDOWS\php.ini
Scan for additional .ini files in: (none)
Additional .ini files parsed: (none)
Make sure you are enabling the settings in the correct ini file. If you dont have an ini file loaded put an ini file from the php directory into c:\windows.
Also important
I find it helps to change the extension_dir flag to an absolute path from relative to makesure the system can find php_opensll.dll.
To do this uncomment the line starting extension_dir and change it to match from the drive root.
Example: C:\php\ext instead of ext/
For MAMP users, this is what worked for me.
If your php.ini is located under a \MAMP\conf\
copy the php.ini into a\MAMP\bin\php\php[your PHP version number]\
Restart MAMP and the command-line window
Go to a directory under a command-line window where you want to install composer
run from a command line:
php -r "readfile('http://getcomposer.org/installer');" | php
NOTE: it is http not https !
END
I figured it out and successfully installed Composer in My windows 10 PC.
I am sharing two solutions here.
There are some steps you have to follow in order to solve your problem.
1st solution.
Find and Open php.ini located in your "php" folder In my case it is in xampp the file is in c:\xampp\php\
Find "extension=php_openssl.dll"
";extension=php_openssl.dll" uncomment by removing the semicolon ";"
Restart your xampp , now extension should be loaded after that.
Try again now you are able to install composer.
2nd solution(If the above solution not work for you then go with below solution . )
This works in my case
Find and Open php.ini located in your "php" folder In my case it is in xampp the file is in c:\xampp\php\
Open SHELL from Xampp start panel by clicking on shell button.
Write php in shell and hit enter
If you get some waring message in your shell something like below .
Then you have to fix these waring message by commenting all these extension in your php.ini file.(Actually cause of these warning messages are because more than one time these extensions are enabled but you can un-comment it in php.ini file for solving the issue).
For Example which is in my case.
a). You can see in above image there is warning message for curl.
Module 'curl' already loaded in Unknown on line 0 .
b) To fix this find php_curl.dll file in your php.ini file and comment that extension by adding semicolon ";" in front of that extension like this ;extension=php_curl.dll
Follow above steps if you have more than one warning for each extension untill you are not getting any warning message in your shell.
Restart your xampp , now extension should be loaded after that.
Try again now you are able to install composer.
Hope I can solve your issue .
That's all folks . Happy coding !!! (amitamie.com) :-) ;-)
The problem solved after turn off windows firewall.
installation complete!
I nearly wrapped my head off trying to install composer on my windows 7 machine.
I was trying to install composer through the composer installer from getcomposer.org.
After the common openssl extension enabling (As above answers describing).
The installer has finished the installation successfully. But calling composer on the command line, wasnt
possible. It was telling me composer / application not found, check for typos etc...
Cant getting it running, I looked at the manually install guide and noticed something weird.
The doc said: "Close your current terminal. Test usage with a new terminal:"
I closed my terminal window. Opened a new one and IT WORKED!!!
I had a terminal window open during the composer installation. After that I was trying to call composer via the command line in this terminal. This didnt work.
So why did it not work?
The composer installer downloads the composer.phar file and sets a environment path to it. The terminal only gets the environment PATHS, when it gets started. So of course the path wasnt set for the terminal.
Solution:
If you have a terminal open before the installation just close it and open a new terminal window to get composer ready to use!!!
I hope I can save someone a couple hours of living time.
You can follow this guide:
http://abuango.net/2014/08/16/how-to-install-composer-on-windows-with-xampp/
Hope it helps you.
Find a php.ini in C:\wamp\bin\php\php5.4.16\ (the configuration file of PHP).
Remove ; in lines ;extension=php_openssl.dll and ;extension_dir = "ext". PHP will know that you are using a php_openssl extension and extension_dir is the location of extensions (you can see it in the comment above php_openssl).
Run the Windows command prompt with administrator permissions.
Execute the following command: mklink C:\Windows\php.ini C:\wamp\bin\php\php5.4.16\php.ini
Composer search php.ini in C:\Windows\php.ini and you have your PHP in WAMP. With mklink command you create a link php.ini that aim to your WAMP's php.ini.
i was facing the same issue but i fixed that,
if you are using wamp
goto your selected php version directory and then you need to edit that directory php.ini file
replace this line ;extension=php_openssl.dll to extension=php_openssl.dll and save and then restart then it will be working :)
Beside all of the above If php/xampp is not installed in c drive this problem occurred (what happened with me).
In that case please follow this link :
http://abuango.net/2014/08/16/how-to-install-composer-on-windows-with-xampp/
I was facing the same issue in windows 7 PC with xampp.
Cannot open '\xampp\php\extras\browscap.ini' for reading in Unknown on line 0
I just change the value of 'browscap' in php.ini file. Use full path instead of absolute path.
In my case Xampp was in E drive so I have changed
browscap="\xampp\php\extras\browscap.ini"
to
browscap="E:\xampp\php\extras\browscap.ini"
And it works for me!
I have MAMP with PHP 5.5.3 installed.
The ending of my php.ini file (MAMP/conf/php5.5.3/php.ini) is this:
[OPcache]
zend_extension="/Applications/MAMP/bin/php/php5.5.3/lib/php/extensions/no-debug-non-zts-20121212/opcache.so"
opcache.memory_consumption=128
opcache.interned_strings_buffer=8
opcache.max_accelerated_files=4000
opcache.revalidate_freq=60
opcache.fast_shutdown=1
opcache.enable_cli=1
[xdebug]
xdebug.default_enable=1
xdebug.remote_enable=1
xdebug.remote_handler=dbgp
xdebug.remote_host=localhost
xdebug.remote_port=9000
xdebug.remote_autostart=1
zend_extension="/Applications/MAMP/bin/php/php5.5.3/lib/php/extensions/no-debug-non-zts-20121212/xdebug.so"
Still, xdebug doesn't work when testing with a var_dump().
What else can I try?
EDIT:
I have restarted MAMP every time I tried changing something.
I also checked phpinfo().
It says here that I need to edit the file from MAMP, not from the finder. But I can't find where MAMP lets me go to the file...
Apparently, I was editing the wrong php.ini file...
The correct php.ini is MAMP/bin/php/php5.5.3/conf/php.ini instead of MAMP/conf/php5.5.3/php.ini.
I feel so stupid now. :)
Everyone thanks for helping.
Once you have php.ini set up, there will be a checkbox in the php panel of MAMP that says "activate xdebug". Check that.
For people like me copying and pasting the php.ini settings from blogs/SO for xdebug without properly reading, my issue was the path
extensions/no-debug-non-zts-20151012
Please check the path of the extension on your machine and update accordingly.
Danger on newer mamp downloads, that comes with 7.3 php versions, and xdebug not supported yet as we can see here.
https://www.mamp.info/en/release-notes/mac/
to make it work, just need to load latest PHP functional version 7.2.14:
1- rename all the others php options in Applications/MAMP/bin/php, like '"_"php5.4.45' but not the 7.2.14 version, that will force mamp to use this version.
2- At the bottom of the ini file, in Applications/MAMP/bin/php/php7.2.14/conf/php.ini, Delete the ';' in xdebugg line.
3- Restart Mamp
4- Enjoy.