PHP头条
热点:

clion开发调试php7扩展


生成扩展框架

执行php7源码/xxx/php-7.1.3/ext目录下的ext_skel命令,生成扩展框架

$ /xxx/php-7.1.3/ext/ext_skel --extname=ljtest //ljtest为扩展名

编译并把扩展加入php

$ cd ljtest
$ /usr/local/php-7.1.3/bin/phpize
$ ./configure --with-php-config=/usr/local/php-7.1.3/bin/php-config
$ make
$ sudo make install

把编译好的扩展加到php.ini中,用/usr/local/php-7.1.3/bin/php -m 看一下扩展是否按照

用clion导入扩展代码

这里写图片描述

编辑CMakeLists.txt

cmake_minimum_required(VERSION 3.7)
project(ljtest)
add_custom_target(makefile COMMAND make && sudo make install WORKING_DIRECTORY ${PROJECT_SOURCE_DIR})

注:编辑完后要重新reload一下

编辑 config.m4

按照提示把dnl注释去掉

dnl $Id$
dnl config.m4 for extension ljtest

dnl Comments in this file start with the string 'dnl'.
dnl Remove where necessary. This file will not work
dnl without editing.

dnl If your extension references something external, use with://如果需要使用第三方扩展就去掉下面的dnl注释

dnl PHP_ARG_WITH(ljtest, for ljtest support,
dnl Make sure that the comment is aligned:
dnl [ --with-ljtest Include ljtest support])

dnl Otherwise use enable://否则就去掉下面的注释

PHP_ARG_ENABLE(ljtest, whether to enable ljtest support,
Make sure that the comment is aligned:
[ --enable-ljtest Enable ljtest support])

配置clion

选择Edit Configurations
这里写图片描述
进入编辑页面
这里写图片描述
注:如果没有马克file选项,说明在配置完CMakeLists.txt时没有reload
点击run,如果出现下图就说明成功了
这里写图片描述

debug

打断点,按debug加入debug
这里写图片描述


www.phpzy.comtrue/phpzx/49400.htmlTechArticleclion开发调试php7扩展 生成扩展框架 执行php7源码/xxx/php-7.1.3/ext目录下的ext_skel命令,生成扩展框架 $ /xxx/php-7.1.3/ext/ext_skel --extname = ljtest //ljtest为扩展名 编译并把扩展加入php $ cd ljtest $...

相关文章

PHP之友评论

今天推荐