Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cakephp + Visual Studio tools for PHP

I'm trying to debug my cakephp application with php tools for Visual studio (2013).

I'm not able to do it, it doesn't respect the routing when I try to debug.

Someone know how to do it?

like image 472
Manjar Avatar asked Feb 21 '15 17:02

Manjar


1 Answers

To debug a cakephp app using MS Visual Studio 2013, I did these steps and it's working fine for me :

  • 1 - create a new PHP Web Project.
  • 2 - copy your ( new created ) cakephp app to the directory of the PHP Web project and include all the app to it.

So you will get something like this :

  • 3 - then we will set the startup options ( from Debug menu -> project properties or right click on your project then properties ).

For the debug, we will use IIS Express, so if you don't have it installed yet, you can install it from the same window via the MS Web Platform Installer :

So you will get something like this :

  • 4 - Then we have to set our url rewriting rules like it's mentioned here, just put the web.config in the root of your project :

web.config content :

<?xml version="1.0" encoding="UTF-8"?>
<configuration> 
    <system.webServer>
        <rewrite>
            <rules>
                <rule name="Exclude direct access to webroot/*"
                  stopProcessing="true">
                    <match url="^webroot/(.*)$" ignoreCase="false" />
                    <action type="None" />
                </rule>
                <rule name="Rewrite routed access to assets(img, css, files, js, favicon)"
                  stopProcessing="true">
                    <match url="^(img|css|files|js|favicon.ico)(.*)$" />
                    <action type="Rewrite" url="webroot/{R:1}{R:2}"
                      appendQueryString="false" />
                </rule>
                <rule name="Rewrite requested file/folder to index.php"
                  stopProcessing="true">
                    <match url="^(.*)$" ignoreCase="false" />
                    <action type="Rewrite" url="index.php"
                      appendQueryString="true" />
                </rule>
            </rules>
        </rewrite>
    </system.webServer>
</configuration>

  • 5 - Press F5 ( or Debug -> Start debugging ) :

Then

That's all !

Hope that can help.

like image 135
akmozo Avatar answered Oct 08 '22 13:10

akmozo