8

I have a computer with apache2 and php7, I setup the php.ini to use xdebug and its ok, I can debug using an editor.

But I want to debug in another computer that has only php.

I started the server using: php -S localhost:8080

I tried to use the same php.ini, but it seems that php built-in web server can't understant the php.ini

I used the command: php -S localhost:8080 -c <<path to my php.ini>>

Here the phpinfo output from apache server:

enter image description here

and here the output from built-in web server:

enter image description here

danilo
  • 7,680
  • 7
  • 43
  • 46
  • Why not use [Kint](https://github.com/kint-php/kint)? It's better than xdebug, and doesn't require being installed into the php distribution. – mopsyd Nov 26 '17 at 03:14
  • 1
    @Danilo I'm not sure why `report_zend_debug` option should matter here -- AFAIK it has no relation to xdebug at all. if anything -- you should be looking at `xdebug` specific section. P.S. PHP's built-in web server works fine with xdebug -- otherwise it would not be possible to use it with Laravel/Symfony that use it (by default in manuals) for local dev. – LazyOne Nov 27 '17 at 14:52
  • @LazyOne, Thanks very much for your contribution, I don't know if the **php.ini** was loaded, because if I give a wrong path then the built-in web server runs, but without issuing errors, I tried in many ways, using full path: `php -S localhost:8080 -c c:/php/php7/php.ini`, I copied the **php.ini** to the current directory and called: `php -S localhost:8080 -c php.ini` – danilo Nov 27 '17 at 16:17
  • @Danilo You can see all config file(s) parsed and loaded by current PHP executable in `phpinfo()` output header table (or with `--ini` param in command line). Full path to the config file is recommended; try with Windows path delimiters since you seem to be on Windows. – LazyOne Nov 27 '17 at 16:27
  • 1
    @LazyOne, It works now, yes, phpinfo() shows me that xdebug is active, my problem was on notepad++ plugin and not on built-in web server, thanks very much. – danilo Nov 28 '17 at 12:57
  • @Danilo Try IDE (I'm using PhpStorm -- recommend; paid software; or NetBeans -- free) or another more advanced text editor (e.g. VisualStudio Code -- it's free; Sublime text) -- in general they are better than Notepad++ for web development tasks. – LazyOne Nov 28 '17 at 13:20
  • wow! Great! VS Code is awesome! – danilo Nov 29 '17 at 12:55
  • @mopsyd because kint is not a debugger... – Christian Sep 07 '22 at 13:23

1 Answers1

5

You need to pass php.ini before -S:

php -c /path/to/php.ini -S localhost:8080
Alexar
  • 1,858
  • 5
  • 24
  • 34