标签归档:linux

linux下安装xdebug

安装其实挺简单的  官方就给出了安装方法

Compiling

There is a wizard available that provides you with the correct file to download, and which paths to use.

You compile Xdebug separately from the rest of PHP. Note, however, that you need access to the scripts ‘phpize’ and ‘php-config’. If your system does not have ‘phpize’ and ‘php-config’, you will need to compile and install PHP from a source tarball first, as these script are by-products of the PHP compilation and installation processes. (Debian users can install the required tools with apt-get install php5-dev). It is important that the source version matches the installed version as there are slight, but important, differences between PHP versions. Once you have access to ‘phpize’ and ‘php-config’, do the following:

  1. Unpack the tarball: tar -xzf xdebug-2.2.1.tgz. Note that you do not need to unpack the tarball inside the PHP source code tree. Xdebug is compiled separately, all by itself, as stated above.
  2. cd xdebug-2.2.1
  3. Run phpize: phpize (or /path/to/phpize if phpize is not in your path). Make sure you use the phpize that belongs to the PHP version that you want to use Xdebug with. See this FAQ entry if you’re having some issues with finding which phpize to use.
  4. ./configure –enable-xdebug
  5. make
  6. make install

Configure PHP to Use Xdebug

  1. add the following line to php.ini: zend_extension=”/wherever/you/put/it/xdebug.so” (for non-threaded use of PHP, for example the CLI, CGI or Apache 1.3 module) or: zend_extension_ts=”/wherever/you/put/it/xdebug.so” (for threaded usage of PHP, for example the Apache 2 work MPM or the the ISAPI module). Note: In case you compiled PHP yourself and used –enable-debug you would have to use zend_extension_debug=. From PHP 5.3 onwards, you always need to use the zend_extension PHP.ini setting name, and not zend_extension_ts, nor zend_extension_debug. However, your compile options (ZTS/normal build; debug/non-debug) still need to match with what PHP is using.
  2. Restart your webserver.
  3. Write a PHP page that calls ‘phpinfo()‘ Load it in a browser and look for the info on the Xdebug module. If you see it next to the Zend logo, you have been successful! You can also use ‘php -m’ if you have a command line version of PHP, it lists all loaded modules. Xdebug should appear twice there (once under ‘PHP Modules’ and once under ‘Zend Modules’).

需要注意的就是以下几点

1 如果是yum安装的php  那么你可能没有安装php-devel 那么phpize这个命令是用不了的

那么phpize又是什么东西了? http://php.net/manual/en/install.pecl.phpize.php 这里是官方说明

phpize其实就是用来扩展php扩展模块的,通过phpize可以建立php的外挂模块

比如你想在原来编译好的php中加入memcached或者ImageMagick等扩展模块,可以使用phpize,通过以下几步工作。

2 make install这一步
因为我的php是用yum安装的 所以其文件夹需要root权限才能访问修改 make install 会把编译好的xdebug.so放入到 /usr/lib/php/modules/ 这个文件集 需要root 所以记得切换用户

当然make install这一步其实也可以不用 这一步在这里的唯一作用就是将xdebug.so放入到那个文件夹 如果不make install 我们只需在php.ini加载扩展时写好正确路径就好

3  配置xdebug

直接在最下面配置就好

tar切换目录打包

tar是个很常用的命令 有时候我们在/root下打包其他目录的文件 总是会带上不需要的上层目录
虽然可以cd到目标目录在tar 但是其实也是有办法的

执行命令时发现找不到new_app 猜测可能切换目录要放到前面

上述两条都是成功的
至于解压包的时候 -C 就无所谓放哪了

ps:–exclude排除某个文件夹的时候 最后面不要加/