phalcon 3 php7在php7出后,那点性能优势还有优势吗

phalcon(6)
Phalcon 是开源、全功能栈、使用 C 扩展编写、针对高性能优化的 PHP 5 框架。 开发者不需要学习和使用 C 语言的功能, 因为所有的功能都以 PHP 类的方式暴露出来,可以直接使用。 Phalcon 也是松耦合的,可以根据项目的需要任意使用其他对象。
Phalcon是一套实现MVC架构的高性能php应用程序框架。初始版本发布于2012年11月,开放源代码并基于BSD授权条款。与其他大部分的PHP框架不同,Phalcon是以扩展的方式以所编写,因此Phalcon的执行速度高过其他PHP框架,并且消耗更少的资源,根据官方的测试,Phalcon是目前世界上速度最快的PHP框架,
没有之一。
php需要高于5.4版本 即为 5.5以上的php环境,若环境低于5.5版本,请安装或者切换版本即可
运用的地方为高并发等平台,可以用来做接口或者网站,就医160应该是采用了该php框架。
官方的github位置 :
文档社区:
linux操作命令为:
git clone git:///phalcon/cphalcon.git
cd cphalcon/build
sudo ./install
Add the extension to your php.ini:
extension=phalcon.so
但是&sudo ./install 命令总是会存在报错的情况,接下来处理下问题:
&&sudo ./install
php 5.4 not longer supported & 该版本不支持
解决方案1:
更改phalcon 安装文件的源代码 & 譬如路径下&/root/cphalcon/build &用记事本(别用其他编辑器哦) 删除一下代码
fi &if [ &${PHP_FULL_VERSION:0:3}& == &5.4& ]; then
echo &php 5.4 is no longer supported&
解决方案2:
重新编译新的php 版本或者重新安装新的版本或者切换php 版本
譬如切换 到php 的最新版 php7
加入你的服务器放的是onestack的镜像
最后探针一下&
成功,phalcon+php7 的服务器环境,简直是如虎添翼!
---------------------------------------------若有Zephir
或者&PHP7以下的版本请忽略-------------------------------------------------------------------------
万事具备只欠东风,但是值得一提的是php7高性能的php 环境下要安装phalcon ,坑还是不少,
In file included from /root/cphalcon/build/php7/64bits/phalcon.zep.c:174:0:
/root/cphalcon/build/php7/64bits/php_phalcon.h:58:2: error: unknown type name 'zend_array'
& zend_array *symbol_
解决方案:
首先要安装好
安装Zephir
支持PHP7版本的Phalcon2.1.x不支持普通方式的编译安装,只能通过zephir安装。因此安装phalcon之前,请先安装Zephire。安装方法如下:
$zypper in re2c
$git clone /phalcon/zephir.git
$cd zephir
$./install -c
其他版本的linux可以自己搜索安装re2c,Mac通过brew也可以安装。
安装完成后可以通过zephir命令查看相关的命令参数与功能
编译之前请确认which php&和which
phpize指向PHP7版本
安装代码如下:
git clone /phalcon/cphalcon
cd cphalcon
zephir build --backend=ZendEngine3
编译完成后将extension=phalcon.so加入php.ini文件,重启php-fpm和nginx(我装的是lnmp)。
可以通过php -i|grep phalcon查看是否安装成功,也可以通过web页面输出phpinfo()来查看
小编在此说下,phalcon 2.1还属于beta 版本,生产环境还是建议php5.6即可,加上phalcon 足够高性能了
----------------------------------------------若有Zephir
或者-PHP7以下的版本请忽略结束-------------------------------------------------------------------------
或者存在报错情况:
&&sudo ./install
./install: line 24: php-config: command not found
php-config is not installed
yum install php-devel
或者存在报错情况:(madan 足足浪费了我几个钟头,各种重装与命令!操)
config.status: executing libtool commands/bin/bash /root/cphalcon/build/64bits/libtool --mode=compile gcc
-I. -I/root/cphalcon/build/64bits -DPHP_ATOM_INC -I/root/cphalcon/build/64bits/include -I/root/cphalcon/build/64bits/main -I/root/cphalcon/build/64bits -I/usr/include/php5 -I/usr/include/php5/main -I/usr/include/php5/TSRM -I/usr/include/php5/Zend -I/usr/include/php5/ext -I/usr/include/php5/ext/date/lib
-DPHALCON_RELEASE -DHAVE_CONFIG_H
-march=native -mtune=native -O2 -finline-functions -fomit-frame-pointer -fvisibility=hidden
-c /root/cphalcon/build/64bits/phalcon.c -o phalcon.lo
libtool: compile:
gcc -I. -I/root/cphalcon/build/64bits -DPHP_ATOM_INC -I/root/cphalcon/build/64bits/include -I/root/cphalcon/build/64bits/main -I/root/cphalcon/build/64bits -I/usr/include/php5 -I/usr/include/php5/main -I/usr/include/php5/TSRM -I/usr/include/php5/Zend -I/usr/include/php5/ext -I/usr/include/php5/ext/date/lib -DPHALCON_RELEASE -DHAVE_CONFIG_H -march=native -mtune=native -O2 -finline-functions -fomit-frame-pointer -fvisibility=hidden -c /root/cphalcon/build/64bits/phalcon.c
-fPIC -DPIC -o .libs/phalcon.o
这个地方,不动弹
&找到了一个解决方案:
大家不妨试试:(可以)
cd cphalcon/ext
export CFLAGS=&-O2 -finline-functions -fvisibility=hidden&
./configure --enable-phalcon
sudo make install
[root@root ~]# cd cphalcon/ext
[root@root ext]# export CFLAGS=&-O2 -finline-functions -fvisibility=hidden&
[root@root ext]# phpize&
Configuring for:
PHP Api Version: & & & &
Zend Module Api No: & & &
Zend Extension Api No: &
[root@root ext]# ./configure --enable-phalcon
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking for a sed that does not truncate output... /usr/bin/sed
checking for cc... cc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...&
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether cc accepts -g... yes
checking for cc option to accept ISO C89... none needed
checking how to run the C preprocessor... cc -E
checking for icc... no
checking for suncc... no
checking whether cc understands -c and -o together... yes
checking for system library directory... lib
checking if compiler supports -R... no
checking if compiler supports -Wl,-rpath,... yes
checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking target system type... x86_64-unknown-linux-gnu
checking for PHP prefix... /usr/local/php
checking for PHP includes... -I/usr/local/php/include/php -I/usr/local/php/include/php/main -I/usr/local/php/include/php/TSRM -I/usr/local/php/include/php/Zend -I/usr/local/php/include/php/ext -
I/usr/local/php/include/php/ext/date/lib
checking for PHP extension directory... /usr/local/php/lib/php/extensions/no-debug-non-zts-
checking for PHP installed headers prefix... /usr/local/php/include/php
checking if debug is enabled... no
checking if zts is enabled... no
checking for re2c... no
configure: WARNING: You will need re2c 0.13.4 or later if you want to regenerate PHP parsers.
checking for gawk... gawk
checking whether to enable phalcon... yes, shared
checking whether HAVE_BUNDLED_PCRE is declared... yes
checking for ext/pcre/php_pcre.h... yes
checking whether HAVE_JSON is declared... yes
checking for ext/json/php_json.h... yes
checking for ld used by cc... /usr/bin/ld
checking if the linker (/usr/bin/ld) is GNU ld... yes
checking for /usr/bin/ld option to reload object files... -r
checking for BSD-compatible nm... /usr/bin/nm -B
checking whether ln -s works... yes
checking how to recognize dependent libraries... pass_all
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking dlfcn.h usability... yes
checking dlfcn.h presence... yes
checking for dlfcn.h... yes
checking the maximum length of command line arguments... 1572864
checking command to parse /usr/bin/nm -B output from cc object... ok
checking for objdir... .libs
checking for ar... ar
checking for ranlib... ranlib
checking for strip... strip
checking if cc supports -fno-rtti -fno-exceptions... no
checking for cc option to produce PIC... -fPIC
checking if cc PIC flag -fPIC works... yes
checking if cc static flag -static works... no
checking if cc supports -c -o file.o... yes
checking whether the cc linker (/usr/bin/ld -m elf_x86_64) supports shared libraries... yes
checking whether -lc should be explicitly linked in... no
checking dynamic linker characteristics... GNU/Linux ld.so
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... yes
checking whether to build static libraries... no
creating libtool
appending configuration tag &CXX& to libtool
configure: creating ./config.status
config.status: creating config.h
config.status: config.h is unchanged
[root@root ext]# make
/bin/sh /root/cphalcon/ext/libtool --mode=install cp ./phalcon.la /root/cphalcon/ext/modules
cp ./.libs/phalcon.so /root/cphalcon/ext/modules/phalcon.so
cp ./.libs/phalcon.lai /root/cphalcon/ext/modules/phalcon.la
PATH=&$PATH:/sbin& ldconfig -n /root/cphalcon/ext/modules
----------------------------------------------------------------------
Libraries have been installed in:
& &/root/cphalcon/ext/modules
If you ever happen to want to link against installed libraries
in a given directory, LIBDIR, you must either use libtool, and
specify the full pathname of the library, or use the `-LLIBDIR'
flag during linking and do at least one of the following:
& &- add LIBDIR to the `LD_LIBRARY_PATH' environment variable
& & &during execution
& &- add LIBDIR to the `LD_RUN_PATH' environment variable
& & &during linking
& &- use the `-Wl,--rpath -Wl,LIBDIR' linker flag
& &- have your system administrator add LIBDIR to `/etc/ld.so.conf'
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'.
[root@root]# sudo make install
Installing shared extensions: & & /usr/local/php/lib/php/extensions/no-debug-non-zts-/
Installing header files: & & & & &/usr/local/php/include/php/
增加php.ini 扩展&
extension=/usr/local/php/lib/php/extensions/no-debug-non-zts-/phalcon.so
接下来重启服务器
[root@root ~]# cd /usr/local/nginx/sbin
[root@root sbin]# ./nginx -s reload
重启php-fpm
[root@root]# &/etc/init.d/php-fpm restart
检测是否可运行
[root@root sbin]# php -i|grep phalcon
phalcon =& enabled
phalcon.db.escape_identifiers =& On =& On
phalcon.db.force_casting =& Off =& Off
phalcon.orm.cast_on_hydrate =& Off =& Off
phalcon.orm.column_renaming =& On =& On
phalcon.orm.enable_implicit_joins =& On =& On
phalcon.orm.enable_literals =& On =& On
phalcon.orm.events =& On =& On
phalcon.orm.exception_on_failed_save =& Off =& Off
phalcon.orm.ignore_unknown_columns =& Off =& Off
phalcon.orm.late_state_binding =& Off =& Off
phalcon.orm.not_null_validations =& On =& On
phalcon.orm.virtual_foreign_keys =& On =& On
到处服务器的phalcon 完成了
& phalcon的脚手架工具,支持一组命令
git clone git:///phalcon/phalcon-devtools.git
cd phalcon-devtools/ && sudo ln -s ~/devtools/phalcon.php /usr/bin/phalcon
执行phalcon commands
执行create-project
cd /srv/www/htdocs/ && phalcon create-project store
sudo service php-fpm restart
sudo service nginx restart
具体可参考文章:&
欢迎关注我的github: &&
参考知识库
* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场
访问:4820次
排名:千里之外
原创:66篇
(26)(22)(23)Phalcon 2.0.7 发布,高性能 PHP 框架 - 开源中国社区
当前访客身份:游客 [
当前位置:
Phalcon 2.0.7 发布,高性能 PHP 框架
Phalcon 2.0.7 发布,此版本更新内容如下:Image\Adapter\Gd::save() no longer fails if the method or the instance is created with a filename without an extensionFixed segfault in Image\Adapter\Imagick::text()Exceptions thrown in Volt compiler are now Phalcon\Mvc\View\Engine\ExceptionNow you can import macros from other files using {% include &file.volt& %}Undefined function calls fall back to macro calls in VoltAutomatic bound parameters in Mvc\Model\Criteria now uses a different prefix
than Mvc\Model\Query\Builder to avoid collissionsAdded Cache\Multiple::flush() to flush the cache backends added to the multiple systemFixed Session\Bag::remove()Session\Bag::destroy() eliminates any temporary data in the variables bagafterCreate/afterUpdate are only called if saving related records was successfulAdded an optional parameter removeData to Session\Adapter::remove() to remove any data in $_SESSION that
belongs to the uniqueId or the whole session dataNow session variables making use of unique prefixes use # as internal separatorAdded parameter the changing operator for conditions in method Mvc\Model\Criteria::fromImput() Added \Phalcon\Queue\Beanstalk::listTubes() to get list of a tubesAdded a fix to avoid that a table present in many sub-queries causes invalid SQL generationAdd CookieInterface, update Cookie and Cookies to use this interface - Decoupling Cookies and Cookie - Check Session state before using it in Cookie. Fixed merge of Phalcon\Config instances containing objects different than Phalcon\Config compatible instancesWhen creating tables in Postgres, inline PRIMARY keys are now escaped properlyFixed incorrect generation of SELECT COUNT(\*) causing unexpected exceptions when phqlLiterals is disabledAdded Phalcon\Security\Random - secure random number
generator class. Provides secure random number generator which is
suitable for generating session key in HTTP cookies, etc下载:。PhalconPHP 是一个使用 C 扩展开发的 PHP Web 框架,提供高性能和低资源占用。Phalcon 是一个开源的、全堆栈的 PHP 5 框架,使用 C 扩展编写,专门为高性能优化。无需学习和使用 C 语言,所有函数都以 PHP 类的方式曾现。Phalcon 是一个松耦合的框架。使用时需在 php.ini 中添加:extension=phalcon.so
Phalcon 的详细介绍:
Phalcon 的下载地址:
想通过手机客户端(支持 Android、iPhone 和 Windows Phone)访问开源中国:
旧一篇: 1年前
新一篇: 1年前
相关讨论话题
你也许会喜欢
挺不错!希望大家都用起来!
2楼:lxholding 来自
以这个为基础自定义框架挺简单的
3楼:echard 来自
正在使用中。。。
4楼:隐形人
更新的频率是不是有点儿快
6楼:neo-chen
刚刚升级完,有升级了:(
7楼:eechen
WordPress页面耗时(Firebug网络):Xubuntu14.04(i5-3230M)PHP7
20~50 ms (开启ZendOpcache)PHP7 100~150msPHP5 200~250ms跟本地静态页对比:time curl -I /app/wordpress/readme.html 耗时 0m0.015stime curl -I /app/wordpress/ 耗时 0m0.115stime curl -I /app/wordpress/ 耗时 0m0.035s (开启ZendOpcache)PHP7(ZendOpcache)驱动的WordPress的速度接近静态页的速度:新的zval结构体,opcache缓存,PCRE JIT,这些都能有效提升真实应用的性能.等以后把JIT加入到ZendOpcache后,计算能力也得爆表./zendtech/php-src/tree/zend-jit/ext/opcache/jit
8楼:都市网达
9楼:码农界傲娇段子手
引用来自“eechen”的评论WordPress页面耗时(Firebug网络):Xubuntu14.04(i5-3230M)PHP7
20~50 ms (开启ZendOpcache)PHP7 100~150msPHP5 200~250ms跟本地静态页对比:time curl -I /app/wordpress/readme.html 耗时 0m0.015stime curl -I /app/wordpress/ 耗时 0m0.115stime curl -I /app/wordpress/ 耗时 0m0.035s (开启ZendOpcache)PHP7(ZendOpcache)驱动的WordPress的速度接近静态页的速度:新的zval结构体,opcache缓存,PCRE JIT,这些都能有效提升真实应用的性能.等以后把JIT加入到ZendOpcache后,计算能力也得爆表./zendtech/php-src/tree/zend-jit/ext/opcache/jit能否架个php7的演示站?
10楼:eechen
解压即用,跨Linux发行版PHP7打包
11楼:码农界傲娇段子手
引用来自“eechen”的评论
解压即用,跨Linux发行版PHP7打包叼
12楼:eechen
Xubuntu(i5-3230M)上,简单的time curl WordPress首页测试,PHP7 Beta2比HHVM最新的3.8.1快了32%!PHP7和HHVM均进行了热身,PHP7缓存有opcode,HHVM缓存有bytecode(hhbc即hiphop bytecode).
13楼:jacky_chen 来自
明天升级起来
与内容无关的评论将被删除,严重者禁用帐号
本周热点资讯
本站最新资讯phalcon在php7出后,那点性能优势还有优势吗_百度知道

我要回帖

更多关于 phalcon3 性能 的文章

 

随机推荐