Getting Xampp working with VS.Php for Visual Studio
Many customers have asked me how to configure Xampp to work with VS.Php. Tonight, I went through the process of doing this and documented each step so you don't have to figure this out by yourself.
The first step is to decide where to install Xampp. I decided to go with the default location. A lot of further steps assume this location. If you pick a different location make sure you take this into consideration.
The next step is choosing what components to install. I chose Apache and MySql servers. I also wanted to install them as services.
In my system, I already have IIS install. This means that Apache is going to fail to start because it is trying to use port 80.
So I went to the httpd.conf and changed the listening port to port 8080. If don't have IIS installed, don't do this.
The next step is to enable XDebug in PHP. To do this, I need to update php.ini and insert the following text:
Please note that the path to the xdebug.dll needs to be the full path. Also, the version of Xampp that I installed uses PHP 5.3 so I'm using the Xdebug version for PHP 5.3 as the path to the dll specifies the version of PHP.
For convenience, here is the text you need to paste into the file:
zend_extension="C:\Program Files (x86)\Jcx.Software\VS.Php\2010\php 5.3\ext\php_xdebug.dll"
; Module Settings ;
xdebug.idekey = vsphp
xdebug.remote_enable = 1
xdebug.remote_host = 127.0.0.1
xdebug.remote_port = 7870
xdebug.remote_autostart = 1
At this point it is a good time to restart Apache using the Xampp tool:
Once you restart Apache, you are ready to create a new project and start using the PHP debugger in VS.Php.
I'm going to create a simple project but you could potentially create a project from existing folder if you are going to start from something you already have.
The key at this point is to create a project under Apache's document root location.
Note that I'm creating a PHP 5.3 project since Xampp is using PHP 5.3. Also I unchecked the "Create directory for solution". This means that my project will be created right under the htdocs directory as a subdirectory.
The next step is to tell the project not to use the built-in web server and instead use Xampp.
I changed the debug mode into External Mode. Then updated the start URL to point to the Xampp server.
Now when I hit F5, the debugger can let you step into the code:
That's all you need to do to get Xampp working with VS.Php. If you have further questions please post a comment on this blog.