zoukankan      html  css  js  c++  java
  • Mac系统下的php扩展开发

    通常在开发PHP的时候,一些核心代码,比如加密函数或需要高效率执行的代码,此时可以用C语言写扩展。本文主要介绍了扩展的开发流程,具体的代码实现参考生成的文件说明。

    当前PHP使用的是XAMPP 5.6.8,安装路径是:/Applications/XAMPP/。

    1. 开始之前,从网站上下载php 5.6.8的扩展,下载地址:http://php.net/get/php-5.6.8.tar.bz2/from/a/mirror 

    2. 解压后进入ext目录,执行:./ext_skel --extname=test,会在ext目录下生成test目录,此目录下建立了扩展名称为test的开发框架

    3. 进入test目录,编辑config.m4文件

    将如下行的注释标签"dnl"去掉,修改后如下所示:

    PHP_ARG_ENABLE(myfunctions, whether to enable myfunctions support,

    Make sure that the comment is aligned:

    [  --enable-myfunctions           Enable myfunctions support])

    4. 使用phpize生成configure文件(phpize路径为:/Applications/XAMPP/xamppfiles/bin/phpize)

    5. 执行命令:./configure --with-php-config=/Applications/XAMPP/xamppfiles/bin/php-config

    6. 执行命令: make编译扩展

    7. 执行命令:sudo make install 安装扩展

    8. 修改php.ini文件(路径:/Applications/XAMPP/xamppfiles/etc/php.ini)

    9. 重启apache,依次执行一下命令:

    sudo /Applications/XAMPP/xamppfiles/apache2/scripts/ctl.sh stop

    sudo /Applications/XAMPP/xamppfiles/apache2/scripts/ctl.sh start

  • 相关阅读:
    Android控件显示和隐藏
    Android Viewpager+Fragment实现滑动标签页
    Android中的color使用
    Android自定义Button按钮显示样式
    Android通过Intent传递对象
    Android中AsyncTask的使用
    iOS,推送通知
    UIWebView与JS的交互
    iOS蓝牙中的进制转换,数据格式转换
    Core Graphics 定制UIVIew 处理图片
  • 原文地址:https://www.cnblogs.com/springwind2006/p/5876223.html