设为首页 收藏本站
查看: 582|回复: 0

[经验分享] XDEBUG for PHP 5.3.0

[复制链接]

尚未签到

发表于 2017-3-27 12:33:53 | 显示全部楼层 |阅读模式
PHP5.3.0中原来不能用zend_extension_ts这种扩展方式实现了, 在网上找了很久,一直以为自已弄错了, 没有到在官方的文档中找到了。

Precompiled Modules

There are a few precompiled modules for Windows, they are all for the non-debug version of PHP. See the links on the right side.

Installing the precompiled modules is easy. Just place them in a directory, and add the following line to php.ini: (don't forget to change the path and filename to the correct one — but make sure you use the full path)

zend_extension_ts="c:/php/modules/php_xdebug-4.4.1-2.0.5.dll"

From PHP 5.3 onwards, you need to use zend_extension and not zend_extension_ts.

Compiling

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 php4-dev, or 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.0.5.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.0.5
   3. Run phpize: phpize (or /path/to/phpize if phpize is not in your path). See in the table below which version numbers it should show for different PHP versions. Make sure you use the phpize that belongs to the PHP version that you want to use Xdebug with.
   4. ./configure --enable-xdebug (or: ./configure --enable-xdebug --with-php-config=/path/to/php-config if php-config is not in your path).

      If this fails with something like:

      ../configure: line 1960: syntax error near unexpected token
      `PHP_NEW_EXTENSION(xdebug,'
      ../configure: line 1960: `  PHP_NEW_EXTENSION(xdebug, xdebug.c
      xdebug_code_coverage.c xdebug_com.c xdebug_handler_gdb.c
      xdebug_handler_php3.c xdebug_handlers.c xdebug_llist.c xdebug_hash.c
      xdebug_profiler.c xdebug_superglobals.c xdebug_var.c usefulstuff.c,
      $ext_shared)'

      then it means that you do not meet the PHP 4.3.x version requirement for Xdebug.

      Another problem that might occur is:

      configure: line 1145: PHP_INIT_BUILD_SYSTEM: command not found
      configure: line 1151: syntax error near unexpected token `config.nice'
      configure: line 1151: `PHP_CONFIG_NICE(config.nice)'

      You will need to upgrade your autotools (autoconf, automake and libtool) or install the known working versions: autoconf-2.13, automake-1.5 and libtool-1.4.3.
   5. make
   6. cp modules/xdebug.so /to/wherever/you/want/it

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 zend_extension and not zend_extension_ts.
   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').

Compatibility

Xdebug does not work together with the Zend Optimizer or any other Zend extension (DBG, APD etc). This is due to compatibility problems with those modules. We will be working on figuring out what the problems are, and of course try to fix those.
phpize Output Table

PHP Version: PHP Api Version: Zend Module Api No: Zend Extension Api No: Recommended version:
4.4.x 20020918 20020429 20050606 2.0.5
5.1.x 20041225 20050922 220051025 2.0.5
5.2.x 20041225 20060613 220060519 2.0.5

Debugclient Installation

Unpack the Xdebug source tarball and issue the following commands:

$ cd debugclient
$ ./configure --with-libedit
$ make
# make install

This will install the debugclient binary in /usr/local/bin unless you don't have libedit installed on your system. You can either install it, or leave out the '--with-libedit' option to configure. Debian 'unstable' users can install the library with apt-get install libedit-dev libedit2.

If the configure script can not find libedit and you are sure you have (and it's headers) installed correctly and you get link errors like the following in your configure.log:

/usr/lib64/libedit.so: undefined reference to `tgetnum'
/usr/lib64/libedit.so: undefined reference to `tgoto'
/usr/lib64/libedit.so: undefined reference to `tgetflag'
/usr/lib64/libedit.so: undefined reference to `tputs'
/usr/lib64/libedit.so: undefined reference to `tgetent'
/usr/lib64/libedit.so: undefined reference to `tgetstr'
collect2: ld returned 1 exit status

you need to change your configure command to:

$ LDFLAGS=-lncurses ./configure --with-libedit

运维网声明 1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其承担任何法律责任,如涉及侵犯版权等问题,请您及时通知我们,我们将立即处理,联系人Email:kefu@iyunv.com,QQ:1061981298 本贴地址:https://www.yunweiku.com/thread-356156-1-1.html 上篇帖子: 一个测试过往PHP版本在新的PHP 5.3下是否兼容的工具 下篇帖子: PHP开发笔记系列(九)- 数组(二)
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

扫码加入运维网微信交流群X

扫码加入运维网微信交流群

扫描二维码加入运维网微信交流群,最新一手资源尽在官方微信交流群!快快加入我们吧...

扫描微信二维码查看详情

客服E-mail:kefu@iyunv.com 客服QQ:1061981298


QQ群⑦:运维网交流群⑦ QQ群⑧:运维网交流群⑧ k8s群:运维网kubernetes交流群


提醒:禁止发布任何违反国家法律、法规的言论与图片等内容;本站内容均来自个人观点与网络等信息,非本站认同之观点.


本站大部分资源是网友从网上搜集分享而来,其版权均归原作者及其网站所有,我们尊重他人的合法权益,如有内容侵犯您的合法权益,请及时与我们联系进行核实删除!



合作伙伴: 青云cloud

快速回复 返回顶部 返回列表