PHP7 学习笔记(七)如何使用zephir编译一个扩展记录
一、zephir 编译遇到的错误
安装
git clone https://github.com/phalcon/zephir
$ cd zephir
$ ./install-json
$ ./install -c
编译
www@ubuntu4:~$ zephir build ────────────────────────────────────────────────────────────
The Zephir Parser extension is not loaded.
Note: Zephir no longer distributed with internal parser. To install latest stable Zephir Parser please refer to:
https://github.com/phalcon/php-zephir-parser
────────────────────────────────────────────────────────────
二、php-zephir-parser 安装
git clone git://github.com/phalcon/php-zephir-parser.git
php7.0-dev 安装报错
www@ubuntu4:~$ sudo apt-get install php7.-dev gcc make re2c autoconf
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package php7.-dev
E: Couldn't find any package by regex 'php7.-dev'
如何让解决
1、php7的存储库的问题,添加php7 ppa
sudo add-apt-repository ppa:ondrej/php
2、更新库
sudo apt-get update
3、现在做一个搜索来确认php7是有的
sudo apt search php7

重新安装,则不会报错
www@ubuntu4:~$ sudo apt-get install php7.-dev gcc make re2c autoconf
Reading package lists... Done
Building dependency tree
Reading state information... Done
gcc is already the newest version.
gcc set to manually installed.
make is already the newest version.
re2c is already the newest version.
The following extra packages will be installed:
automake autotools-dev debhelper dh-apparmor dh-php gettext intltool-debian
libasprintf-dev libgettextpo-dev libgettextpo0 liblist-moreutils-perl
libltdl-dev libmail-sendmail-perl libssl1. libsys-hostname-long-perl
libtool libunistring0 m4 php-common php-pear php-xml php7.-cli
php7.-common php7.-json php7.-opcache php7.-readline php7.-common
php7.-xml pkg-php-tools po-debconf shtool xml2
开始编译
www@ubuntu4:~/ffmpeg_videos/php-zephir-parser$ sudo ./install
Generating parser...
Parser statistics: terminals, nonterminals, rules
states, parser table entries, conflicts
Configuring for:
PHP Api Version:
Zend Module Api No:
Zend Extension Api No:
libtool: compile: gcc -I. -I/home/www/ffmpeg_videos/php-zephir-parser -DPHP_ATOM_INC -I/home/www/ffmpeg_videos/php-zephir-parser/include
-I/home/www/ffmpeg_videos/php-zephir-parser/main -I/home/www/ffmpeg_videos/php-zephir-parser -I/usr/include/php/20151012 -I/usr/include/php//main -I/usr/include/php//TSRM -I/usr/include/php//Zend -I/usr/include/php//ext
-I/usr/include/php//ext/date/lib -DHAVE_CONFIG_H -march=native -mtune=native -O2 -fomit-frame-pointer -fvisibility=hidden -flto
-c /home/www/ffmpeg_videos/php-zephir-parser/zephir_parser.c -fPIC -DPIC -o .libs/zephir_parser.o
或者指定编译配置文件
$./install --phpize /usr/local/php-7.1./bin/phpize --php-config /usr/local/php-7.1./bin/php-config ....
See any operating system documentation about shared libraries for
more information, such as the ld(1) and ld.so(8) manual pages.
----------------------------------------------------------------------
Build complete.
Don't forget to run 'make test'.
Installing shared extensions: /usr/local/php-7.1.11/lib/php/extensions/no-debug-non-zts-20160303/
Cleaning..
Thanks for compiling Zephir Parser!
Build succeed: Please restart your web server to complete the installation
编译完成

查找.so 文件路径
www@ubuntu4:~ sudo find / -name zephir_parser.so
/usr/lib/php//zephir_parser.so
配置php.ini 文件
sudo vim /opt/php-7.1./etc/php.ini
添加一下内容:
[Zephir Parser]
extension=/usr/lib/php//zephir_parser.so

安装完毕
三、重新编译,出现同样的错误:
www@ubuntu4:~/ffmpeg_videos/zephir-framework/lib$ zephir build ────────────────────────────────────────────────────────────
The Zephir Parser extension is not loaded.
Note: Zephir no longer distributed with internal parser. To install latest stable Zephir Parser please refer to:
https://github.com/phalcon/php-zephir-parser
────────────────────────────────────────────────────────────
好纠结啊,如何解决:
直接系统自动默认安装的
rm /usr/bin/php
做个软连接
sudo ln -s /opt/php-7.0./bin/php /usr/bin/php
继续,Ok 了:
www@ubuntu4:~/ffmpeg_videos/zephir-framework/zephirlib$ zephir build
Compiling...
Installing...
Extension installed!
Add extension=zephirlib.so to your php.ini
编译PHP7 如何使用 Cli 命令而不是软连接
root用户,sudo vim /etc/profile,添加PHP7编译的路径:
export PATH=$PATH:/usr/local/php-7.1.8/bin,执行source profile使生效
PHP7 学习笔记(七)如何使用zephir编译一个扩展记录的更多相关文章
- PHP7 学习笔记(十六)Yaconf 一个高性能的配置管理扩展
鸟哥博客原文:Yaconf – 一个高性能的配置管理扩展 什么是yaconf ? 它使用单独的一个配置目录(在yaconf.directory指定), 不和代码在一起.它在PHP启动的时候, 处理所有 ...
- Typescript 学习笔记七:泛型
中文网:https://www.tslang.cn/ 官网:http://www.typescriptlang.org/ 目录: Typescript 学习笔记一:介绍.安装.编译 Typescrip ...
- (转)Qt Model/View 学习笔记 (七)——Delegate类
Qt Model/View 学习笔记 (七) Delegate 类 概念 与MVC模式不同,model/view结构没有用于与用户交互的完全独立的组件.一般来讲, view负责把数据展示 给用户,也 ...
- Learning ROS for Robotics Programming Second Edition学习笔记(七) indigo PCL xtion pro live
中文译著已经出版,详情请参考:http://blog.csdn.net/ZhangRelay/article/category/6506865 Learning ROS forRobotics Pro ...
- python3.4学习笔记(七) 学习网站博客推荐
python3.4学习笔记(七) 学习网站博客推荐 深入 Python 3http://sebug.net/paper/books/dive-into-python3/<深入 Python 3& ...
- Go语言学习笔记七: 函数
Go语言学习笔记七: 函数 Go语言有函数还有方法,神奇不.这有点像python了. 函数定义 func function_name( [parameter list] ) [return_types ...
- iOS 学习笔记七 【博爱手把手教你使用2016年gitHub Mac客户端】
iOS 学习笔记七 [博爱手把手教你使用gitHub客户端] 第一步:首先下载git客户端 链接:https://desktop.github.com 第二步:fork 大神的代码[这里以我的代码为例 ...
- 【opencv学习笔记七】访问图像中的像素与图像亮度对比度调整
今天我们来看一下如何访问图像的像素,以及如何改变图像的亮度与对比度. 在之前我们先来看一下图像矩阵数据的排列方式.我们以一个简单的矩阵来说明: 对单通道图像排列如下: 对于双通道图像排列如下: 那么对 ...
- Linux学习笔记(七) 查询系统
1.查看命令 (1)man 可以使用 man 命令名称 命令查看某个命令的详细用法,其显示的内容如下: NAME:命令名称 SYNOPSIS:语法 DESCRIPTION:说明 OPTIONS:选项 ...
随机推荐
- Oracle 的ORION工具简单使用
1. 下载地址: http://www.oracle.com/technetwork/cn/topics/index-088165-zhs.html 2. linux x64 还有 windows的 ...
- 搭建Spark所遇过的坑
一.经验 1.Spark Streaming包含三种计算模式:nonstate .stateful .window 2.kafka可通过配置文件使用自带的zookeeper集群 3.Spark一切操作 ...
- 在做销售录入界面时,如何使用dbgrid?(50分)
给你段源码看一看用stringgird做得: procedure Tfrmingoods.adddata ; var i:integer; begin do begin ,i])=trim(goods ...
- jquery 動畫
animate({param},speed,callback)/animate({param},speed)/animate({param}) param表示css屬性:屬性名必須是camel標識法: ...
- Python连接字符串用join还是+
我们先来看一下用join和+连接字符串的例子 str1 = " ".join(["hello", "world"]) str2 = &quo ...
- 利用可变参数打印log2
#pragma once #include <string> #include "StdAfx.h" #include <Windows.h> using ...
- BZOJ2277[Poi2011]Strongbox——数论
题目描述 Byteasar is a famous safe-cracker, who renounced his criminal activity and got into testing and ...
- day10 局部变量 全局变量 作用域前奏
规则命名以及基本介绍 name="LHF" # 顶头写的全局都可以调用的就是全局变量,命名规则要求大写全局变量 def chang_name(): # global name # ...
- hdu3516 Tree Construction (区间dp+四边形优化)
构造方法肯定是把相邻两个点连到一起,变成一个新点,然后再把新点和别的点连到一起.... 设f[i,j]为把第i到j个点都连到一起的代价,那么答案就是f[1,n] f[i,j]=min{f[i,k]+f ...
- Jenkins中使用Azure Powershell连接Service Fabric报错not recognized的原因与解决办法
一.使用背景 在涉及Azure service Fabric的自动化应用场景中,依赖于Service Fabric的Azure Powershell cmdlets,我们可以使用Jenkins能实现c ...