Can Xdebug be used with PHP's built-in test server?

Basically my question says it all.

I would like to check the state of my script variables, set breakpoints, etc., without having to install Nginx, apache, or PHP-FPM?

Is this doable if not my options?

+3


source to share


2 answers


So, parting with in this article I was able to use xdebug.

I have installed PHP 5.5 on Mac OS X 10.10 using homebrew




  • Install PHP, if not already installed, be sure to install it with the xdebug extension.
    in my case i used $ brew install php55-xdebug

    , or if you have pecl

    and php is already installed use $ pecl install xdebug

    .
    You can check if the extension is installed by running $ php -m | grep xdebug

    .

  • If you are using VIM as your "IDE" I would recommend installing the vim pathogen plugin and then installing the xdebugger vim plugin ; which I modified to be compatible with the pathogen.

    $ cd ~/.vim/bundle && git clone https://github.com/Triztian/xdebugger.git

  • Next, you need to enable the xdebugger extension; to do this, you first need to figure out which file is being php.ini

    loaded, you can check this by running $ php -i | grep "File => /"

    . Once you have found the correct init file, you must add the following lines at the end:

    xdebug.remote_enable=On


    xdebug.remote_autostart=On

    If you are using PHP's built-in development server , you can use an argument -c

    to specify the php.ini file.

  • Now start the php development server (in my case $ php -S localhost:8080 -c /usr/local/etc/php/5.5/php.ini

    ) and open VIM. After opening VIM, click <f5>

    to make xdebugger start listening for the connection; in your browser go to localhost:8080/index.php

    (or any PHP script) so that it starts the xdebugger connection if everything was configured correctly.

  • You don't have to be in a debugging session, take a look at the readme plugin to see how it works.

+3


source


You can use php built into the web server. This was not intended for development.



-2


source







All Articles