Zephir-开发PHP扩展C
2021/12/31 20:40:46
本文主要是介绍Zephir-开发PHP扩展C,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!
Zephir - 是一种高级编程语言,可简化 PHP 扩展的创建和可维护性。Zephir 扩展导出为 C 代码,可以通过 gcc/clang/vc++ 等主要 C 编译器进行编译和优化。功能暴露给 PHP 语言。
GitHub https://github.com/zephir-lang/zephir
Zephir Parser https://github.com/zephir-lang/php-zephir-parser
Zephir Zephir Documentation
Zephir-Docs Building PHP extensions is easy with Zephir
安装 https://docs.zephir-lang.com/0.12/zh-cn/installation
sudo yum install gcc make re2c autoconf automake # 安装解析器 git clone https://github.com/zephir-lang/php-zephir-parser.git /usr/local/php81/bin/phpize ./configure --with-php-config=/usr/local/php81/bin/php-config make sudo make install sudo vim /usr/local/php81/etc/php.ini extension=zephir_parser ## 下载 php-8.1.1 源码 并 更新开发库 cd /usr/include/php # 备份原文件 sudo mkdir .bak sudo mv * ./.bak/ #引入新文件 sudo ln -s /data/install/php-8.1.1/ext /usr/include/php/ sudo ln -s /data/install/php-8.1.1/include /usr/include/php/ sudo ln -s /data/install/php-8.1.1/main /usr/include/php/ sudo ln -s /data/install/php-8.1.1/sapi /usr/include/php/ sudo ln -s /data/install/php-8.1.1/TSRM /usr/include/php/ sudo ln -s /data/install/php-8.1.1/Zend /usr/include/php/ # 安装 zephir git clone https://github.com/zephir-lang/zephir.git composer install chmod +x zephir sudo ln -s /data/www/jsx/zephir/zephir /usr/local/bin/ ✔> zephir _____ __ _ /__ / ___ ____ / /_ (_)____ / / / _ \/ __ \/ __ \/ / ___/ / /__/ __/ /_/ / / / / / / /____/\___/ .___/_/ /_/_/_/ /_/ Zephir 0.15.2 by Andres Gutierrez and Serghei Iakovlev (source) Usage: command [options] [arguments] Options: --dumpversion Print the version of the compiler and don't do anything else (also works with a single hyphen) -h, --help Print this help message --no-ansi Disable ANSI output -v, --verbose Displays more detail in error messages from exceptions generated by commands (can also disable with -V) --vernum Print the version of the compiler as integer --version Print compiler version information and quit Available commands: api Generates a HTML API based on the classes exposed in the extension build Generates/Compiles/Installs a Zephir extension clean Cleans any object files created by the extension compile Compile a Zephir extension fullclean Cleans any object files created by the extension (including files generated by phpize) generate Generates C code from the Zephir code without compiling it help Display help for a command init Initializes a Zephir extension install Installs the extension in the extension directory (may require root password) stubs Generates stubs that can be used in a PHP IDE
开发扩展 https://docs.zephir-lang.com/0.12/zh-cn/tutorial
cd /data/www/jsx/ zephir init utils touch /data/www/jsx/utils/utils/greeting.zep vim /data/www/jsx/utils/utils/greeting.zep #----------- 文件内容 namespace Utils; class Greeting { public static function say() { echo "hello world!"; } } #----------- 文件内容 cd /data/www/jsx/utils zephir build Zephir version has changed, use "zephir fullclean" to perform a full clean of the project Zephir version has changed, use "zephir fullclean" to perform a full clean of the project Preparing for PHP compilation... Preparing configuration file... Compiling... Zephir version has changed, use "zephir fullclean" to perform a full clean of the project Installing... Extension installed. Add "extension=utils.so" to your php.ini ! [NOTE] Don't forget to restart your web server
这篇关于Zephir-开发PHP扩展C的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!
- 2024-12-19php8的协程和hyperf的协程有什么区别?-icode9专业技术文章分享
- 2024-12-19php8 的fiber是什么?-icode9专业技术文章分享
- 2024-12-05怎么在php8,1 里面开启 debug?-icode9专业技术文章分享
- 2024-12-05怎么在php8,1 里面开启 debug?-icode9专业技术文章分享
- 2024-11-29使用PHP 将ETH账户的资产汇集到一个账户
- 2024-11-23怎么实现安卓+php 热更新方案?-icode9专业技术文章分享
- 2024-11-22PHP 中怎么实现判断多个值是否为空、null 或者为 false?-icode9专业技术文章分享
- 2024-11-11开源 PHP 商城项目 CRMEB 二次开发和部署教程
- 2024-11-09怎么使用php在kaufland平台刊登商品?-icode9专业技术文章分享
- 2024-11-05PHP的抽象类和接口是什么,有什么区别-icode9专业技术文章分享