php xdebug cannot read the solution: 1. Check the version of php; 2. Use "php -m" to check whether xdebug is installed; 3. Configure the debugging statement of xebug.
The operating environment of this article: Windows7 system, PHP7.1 version, DELL G3 computer
What should I do if xdebug cannot read php?
Solution to the problem that php xdebug cannot be debugged on windows
Sometimes when we use php and nginx for development, this situation will occur. Obviously The extension has been installed, but it cannot be debugged successfully. At this time, we must patiently analyze the cause of the problem.
Step one: Check the version of php, such as whether it is x64 or x86, and see if xdebug is activated. You can use phpinfo(); to check whether the extension is activated.
Step 2: Use php -m to check again whether xdebug is installed.
You may encounter xdebug must be loaded as zend extension at this time. This is because we need to change it to zend_extension when configuring extension in php.ini, that is, zend_extension=php_xdebug.dll.
The third step: We need to configure the debugging statement of xebug, that is, we need to fill in the following statement in php.ini
[XDebug] xdebug.remote_enable = 1 xdebug.remote_autostart = 1 xdebug.remote_port=9090 xdebug.remote_host=127.0.0.1
There is a very important point here One parameter is remote_port=9090. The default is 9000, but if you fill in the port 9000, it may cause your php to be unable to debug, because the 9000 port will be occupied by nginx as a proxy.
How to check whether port 9000 is occupied? You can enter the command netstat -anp|findstr "9000" on the command line. If a program occupies port 9000, it will be displayed and we can check its pid. Next, we use tasklist|findstr "2342" (2343 is the pid we just found) to find out which process occupies this port. If it can be closed, close it. If it cannot be closed, we need to modify our port number. For example, the author changed it here to 9090.
Summary: Programming is a process of constantly encountering problems and constantly solving problems. The same code and different environments may lead to different results. The same environment and different parameters. It will also lead to different operations. What we need to do is to continue to deepen our understanding, learn to check error logs, and learn to analyze the program's operating logic, so that we can overcome many difficulties and climb to the top.
For example, here is the issue of debugging. We first need to understand what the principle of debugging is. It is essentially starting a new process to monitor our debugging. It is first an extension of PHP. Many functions of PHP are It is implemented through extensions, such as many commonly used graphics libraries, encryption algorithms, etc. When the extension is activated, PHP will interact with the extension. The xdebug here is used to debug the PHP running information obtained.
Recommended learning: "PHP Video Tutorial"
The above is the detailed content of What should I do if php xdebug cannot read it?. For more information, please follow other related articles on the PHP Chinese website!