By joining Download.com. Mac Apps for Debugging Filter. Profiling and analysis tool for php and xdebug. MacCallGrind Intel Video Pro Analyzer Free.
- Xdebug Mac Download Free
- Xdebug Mac Download Windows 10
- Mac Download Folder
- Configure Xdebug On Windows
- Xdebug: A powerful debugger for PHP. This setting controls which Xdebug features are enabled. This setting can only be set in php.ini or files like 99-xdebug.ini that are read when a PHP process starts (directly, or through php-fpm), but not in.htaccess and.user.ini files, which are read per-request.
- If you’re lucky enough to be using a Mac, you can simply add the following line to your xdebug.ini file instead of worrying about any environment variables: xdebug.remotehost = docker.for.mac.localhost. I hope you find this article helpful. If so, please share! Have a suggestion to make this article better? Let me know in a comment below.
- Debuggers — XDebug and the Zend Debugger — is covered here. Overview of the PDT project The PDT plug-in, when installed with Eclipse Europa, gives you that ability to quickly write and debug PHP scripts and pages. The PDT project supports two debugging tools: XDebug and the Zend Debugger. This tutorial demonstrates how to configure.
In this post, I’m going to go over my short journey to setup my PHP development environment on Windows 10. I will tell you how to setup PHPStorm to debug PHP applications using XDebug and PHP setup over Ubuntu 18.04 LTS on WSL2. I would like to work against the latest version of PHP and compile it myself. At the same time, setting up extensions and compiling PHP itself on windows is not a very straightforward task as far as I know. The plan is to have the development environment run from Linux (WSL2) while the IDE, which is PHPStorm in our scenario execute from Windows. This way I can make use of the “user friendly” parts and beauty of Windows while still running and debugging my code on Ubuntu.
The significant point about WSL2 is that Windows has now switched to full virtualization to run Linux with a good level of integration between the two operating systems. It’s super easy to work with files from both Windows and Linux and it is much quicker than WSL 1. Moreover, Docker is now fully supported making development much easier.
Let me start by telling you how I got here. I’ve been using Ubuntu for the past couple of years. But then I had to move my computer home because of all this WFH stuff. I soon noticed that my accessories and their drivers work nowhere near as smooth as they do on my Mac. After some digging, I finally decided to go back to Windows. Specifically with WSL2 and native Docker support, I thought this would be the perfect time to give them a try. One week in, I’m satisfied with my decision. But this new setup came with its own set of challenges that I’m going to discuss in this post and share my solutions with you.
Environment Information
Before we go any further, it is wise to discuss what my current setup is. I’m running Windows 10 Education build 19041.172. You need a build later than 18917 to enable WSL2. After following a tutorial [like this one] to enable this feature, which includes joining the insider preview program (which is free), you would need to setup something like Ubuntu 18 from the Windows store.
On my Ubuntu on WSL2, I have downloaded and compiled PHP 7.4.4 along with XDebug 2.9.3. On the Windows side, I have installed PHPStorm.
XDebug Remote Debugging
So the idea is to write PHP code in PHPStorm on Windows and run and debug PHP code on Ubuntu over WSL2. To do that, we need to setup remote debugging for XDebug so that PHPStorm can connect to it and set breakpoints, show variable values and step through the code. I’m going to steal this Gif from XDebug website to show you how this is going to work, understanding this architecture helps you with debugging if you run into an issue during this step:
There is also an option to have XDebug identify the IP address of our IDE through the initial HTTP request (xdebug.remote_connect_back) but unfortunately it does not work under our current setup. I did not get into debugging why that does not work. You can take a look at the packets being transmitted in Wireshark and see what goes wrong. I suspect because both of the machines are running on the same network and some weird translations are being performed by WSL2, maybe the Ubuntu sees Windows host packets as if they are coming from 127.0.0.1. So this is what XDebug configuration looks like inside our php.ini file. You will need to modify the zend_extension path to point to your installation of XDebug. You can also uncomment the last line and create the path to the log file if you need to debug this further:
Setting Up PHPStorm
First, we configure PHPStorm to use XDebug. Under File>Settings>Languages & Frameworks > PHP:
- We set the CLI Interpreter to use WSL. It will identify our PHP installation and also tell us that Xdebug is available.
- Under Debug, we enable Xdebug and also uncheck the “Pass required config options through command line” under Advanced settings. (This option will pass XDebug configurations through the CLI and override the configurations we have in php.ini)
- Finally, to run our script, we need a Run/Debug configuration. Notice that we set interpreter options to “-dxdebug.remote_host=wsl2.host”. This is where we tell XDebug what our IP address of the Windows host machine is, to get that debug connection back. Keep this detail in mind, we’ll get back to it.
Windows WSL2 IP Address
Notice how we need to give Windows IP address to XDebug so that it can connect back to PHPStorm. The thing with WSL2, at least in its current form is that the IP range will totally change during reboots. Let’s say the IP range of the network of WSL2 is currently in the range of “172.30.0.1″, the next time you reboot the machine, and its gonna happen with a Windows machine, the IP address will be in the range of “172.16.14.1”. So we need a way to identify this IP address after each reboot. Ideally, a dynamic entry in hosts file that will map “wsl2.host” to this IP address. This way, we don’t have to update our PHPStorm configuration with the correct IP address every time.
My solution is to run a .Net Core application after each reboot. This small application will read the new IP address of Windows WSL2 interface and update the hosts file entry accordingly. The source code is available here: https://github.com/silverfoxy/wsl2_host_ip.
Download the release build of this program. Put it under “Program Files”, and create task under Windows Task Scheduler to run this program with elevated privileges (To update the hosts file) after each login and the action is to run a program which points to our executable.
Xdebug Mac Download Free
Now this will add an entry to the Windows hosts file named “wsl2.host“. Recall that we used this host name earlier in our PHPStorm configuration that is passed through the command line to XDebug so that it can connect back from WSL2 Linux VM to our Windows host machine.
This way, we can use our setup and develop PHP applications on Windows while debugging them against the latest version of PHP on Linux. You can verify this by setting a breakpoint in PHPStorm and the breakpoint should pause the execution. Yaaaay!!
Using X11 Forwarding (Everything Runs on Linux)
There is also an easier way to do this which I briefly introduce. The idea is to use X11 forwarding, install everything (PHP, XDebug, PHPStorm) on Linux and just use the UI on Windows. This also works well, and was not perceivably slower. It feels like the fonts are rendered slightly pixely, but I’m not sure if this is truly the case or just a bias between Windows and Ubuntu fonts for PHPStorm. But after all this is an easier setup. I used VcXsrv for X11 forwarding on Windows and it works well. You can follow this tutorial for this setup: https://medium.com/swlh/get-wsl2-working-on-windows-10-2ee84ef8ed43
From Joomla! Documentation
- 1Edit PHP.INI File for XDebug
For Windows
Starting with version 1.7, XAMPP includes the XDebug PHP debugger, but it needs to be configured for use. To do that, we will edit the 'php.ini' file to configure XDebug. The 'Loaded Configuration File' in the screenshot above tells you what 'php.ini' file is being used. For Windows, this is normally 'c:xamppapachebinphp.ini'.
Important note for Windows 7 & Vista users: As of August 2013 (XAMPP version 1.8.2), the file 'php_xdebug.dll' that is included with XAMPP now works with Windows 7 & Vista. In some earlier versions of XAMPP, the distributed version of XDebug did not work correctly. The symptom of this earlier problem was that the Apache server would stop if this version of XDebug is loaded. To check that you are running the correct version of XDebug on your system, follow these instructions on the XDebug site.
We need to edit this file to configure XDebug as follows:
- Find the line 'implicit_flush' and set it as follows:
- Find the section called '[Zend]' and comment out all of the lines by putting a semi-colon (';') at the start of each line.
- Find the line: zend_extension = 'c:xamppphpextphp_xdebug.dll' and uncomment it out.
- Find the '[XDebug]' section and uncomment out all of the lines (except for the first comment line). For Windows, it should look like the example below:
You do not need to enable XDebug profiling to use XDebug to debug Joomla code. Profiling allows you to find performance bottlenecks in your PHP code. However, enabling profiling with XDebug can slow down your system substantially, so it is not recommended unless you need it. To enable XDebug profiling, add these entries to your php.ini file.
For Windows 7 & Vista, you will use the file downloaded from the XDebug site. So the first line will be
For PHP version 5.3 or later, the '_ts' has been dropped, so the first line will read
In XAMPP 1.7.3 on Windows 7 (currently not verified/tested with prior Windows versions), XDebug may not work correctly if the path to the DLL file is in quotes. In this case, the line should be
For Linux
We will edit the php.ini file to configure XDebug. The Loaded Configuration File in your phpinfo display tells you what php.ini file is being used. For Linux, it will be something like /etc/php/7.2/apache2/php.ini. (The PHP configuration is available in the Administrator of your Website: Administrator > System > System Information > PHP Information tab.)
Edit this file to configure XDebug as follows:
- Find the line implicit_flush and set it as follows:
- Add the following lines at the end:
If using php5-xdebug on Ubuntu The xDebug Configuration detailed above can be appended to:
It should already contain the zend_extension variable and only needs the following variables added:
Tip for users with LAN or remote servers:
Should be set to the IP address of your Eclipse workstation [LAN users] or your public IP. For example:
For Mac OS X
XAMPP for Mac OS X includes the XDebug PHP debugger, but it needs to be added to the 'php.ini' file so that XDebug runs when Apache is started. To do this, open up the php.ini file, located at '/Applications/XAMPP/xamppfiles/etc/php.ini'.
We need to edit this file to configure XDebug as follows:
- Find the line 'implicit_flush' and set it as follows:
- Add the following lines at the end:
Be sure to navigate to the directory where you targeted the extension and check to see that the file path is correct. The folders in your XAMPP installation may be named differently.
The current (as of Sept 2010) version of the XAMPP binary for OS X contains the 2.0.4 version of Xdebug which will not let you see the variable data from included files when running xdebug. You can download a newer version from http://code.activestate.com/komodo/remotedebugging/. Unzip and copy one of the xdebug.so files to /Applications/XAMPP/xamppfiles/lib/php/php-5.3.1/extensions/no-debug-non-zts-20090626. As of Oct 2, 2010 this binary is still out of date (2.1beta3 rather than the stable 2.1) but it will show the variable data appropriately.
Test XDebug Installation
Now, we need to check that XDebug is installed correctly. To do this, we need to re-start XAMPP. In Windows, we can just browse to the 'c:xampp' folder in Windows Explorer and double-click the program 'xampp-control.exe' to open the application shown below.
Xdebug Mac Download Windows 10
Press the 'Stop' button for 'Apache'. The button with then read 'Start'. Press 'Start' for Apache and wait a few seconds and the green 'Running' message will again display. Then press 'Exit' to close the application.
In Windows, if you get 'ERROR: MySQL service not started [-1]', you may be able to correct this by going to c:xamppmysql and running mysql_uninstallservice.bat followed by mysql_installservice.bat.
In Linux, to restart XAMPP execute the command
In Mac, open the 'XAMPP Control' application, stop, and then start the Apache service again.
Once XAMPP has been restarted, open a browser and navigate to 'http://localhost' to display the XAMPP welcome message (if you set XAMPP to listen to another port, you must append the port to the url; e.g.:'http://localhost:8080/'). Press the 'phpinfo()' link again to display the PHP information screen. Scroll down to the lower part of the screen. You should see a section for 'XDebug' as shown below.
Mac Download Folder
Look at the settings you entered in the 'php.ini' file above. You should see these same settings in the xdebug display, as shown below.
At this point, XDebug is set up correctly.
Comments are closed.