Centos PHP configuration xdebug first need to download xdebug, we can click here to download the xdebug-2.2.5.tgz, or download the corresponding installation package on the xdebug official website. Determine the PHP installation directory. assume that the php installation directory is/usr/local/php.
Install xdebug
Xdebug can be compiled and installed independently of PHP, but we must have the permission to execute phpize and have the corresponding permission for php-config. The Directory of the two is
/Usr/local/php/bin/phpize/usr/local/php/bin/php-config
Follow these steps to install xdebug
1. # tar-zxvf xdebug-2.2.5.tg // extract the source package, but note that there is no need to extract the source code to the PHP source package, extract to a separate directory
2. # cd xdebug-2.2.5 // enter the source directory
3. Xdebug] #/usr/local/php/bin/phpize // run the phpize command. after running this command, files such as configure will be generated in the source directory.
4. Xdebug] #./configure-enable-xdebug-with-php-config =/usr/local/php/bin/php-config // configure xdebug
5. Xdebug] # make & make install // compile and install
The option-with-php-config in step 4 cannot be omitted. if this option is omitted, the following error may be reported.
Checking build system type... x86_64-unknown-linux-gnu
Checking host system type... x86_64-unknown-linux-gnu
Checking target system type... x86_64-unknown-linux-gnu
Configure: error: Cannot find php-config. Please use -- with-php-config = PATH
Follow the above steps to install the SDK. if there are no special circumstances, the installation will proceed smoothly. the following result is displayed, indicating that the installation is successful.
Installing shared extensions:/usr/local/php/lib/php/extensions/no-debug-non-zts-20121212/
+ ---------------------------------------------------------------------- +
|
| Installation instructions |
| ===============================|
|
| See http://xdebug.org/install.php#configure-php for instructions |
| On how to enable Xdebug for PHP. |
|
| Documentation is available online as well: |
|-A list of all settings: http://xdebug.org/docs-settings.php |
|-A list of all functions: http://xdebug.org/docs-functions.php |
|-Profiling instructions: http://xdebug.org/docs-profiling2.php |
|-Remote debugging: http://xdebug.org/docs-debugger.php |
|
|
| NOTE: Please disregard the message |
| You shoshould add "extension = xdebug. so" to php. ini |
| That is emitted by the PECL installer. This does not work |
| Xdebug. |
|
+ ---------------------------------------------------------------------- +
Configure PHPMake it support xdebug
According to the above display results, xdebug has been installed successfully, and we need to configure the php. ini file to open the php. ini file.
# Vim/usr/local/php/etc/php. ini // open the php. ini file.
Add the following lines to the file:
Zend_extension =/usr/local/php/lib/php/extensions/no-debug-non-zts-20121212/xdebug. so
[Xdebug]
Xdebug. remote_enable = 1 // enable remote debugging
Xdebug. remote_host = 192.168.18.228 // remote IP address or local IP address
Xdebug. remote_port = 9000 // remote IDE server listening port
Xdebug. remote_handler = DBGP // protocol used
(For more information about the xdebug options, see all the settings of xdebug)
Save and exit. If the PHP environment uses the SAPIs method, we need to restart the Web server. if The FastCGI method is used, we need to restart the php-fpm. After the restart, create a php script and use phpinfo () to view the php configuration, as shown in
It indicates that xdebug is successfully configured in PHP.