Yaf的安装与Hello,world测试
来源:互联网 发布:小蛮腰苏三 网络 编辑:程序博客网 时间:2024/04/30 05:26
1. 安装
Yaf是国内牛人惠新宸写的PHP扩展,是Yet Another Frameword的简称,php官网的文档维护的不好,可参考开发者自己网站上的手册:http://www.laruence.com/manual/。
有三种安装方式:源码、PECL和安装操作系统提供的包。
我用阿里云的服务器,ubuntu12.04,使用apt-get intall安装报错:
The following packages have unmet dependencies:
php5-yaf : Depends: phpapi-20090626
因此从https://pecl.php.net/package/yaf上下载源码,再安装:
其中XXX为源码解压后的目录
cd XXX
sudo phpize
sudo ./configure
sudo make
sudo make install
PS:查看命令行输出,注意解决报错信息。
自己本地的机器是ubuntu14.04,可以直接暗中系统提供的包:
sudo add-apt-repository ppa:mikespook/php5-yaf
sudo apt-get update
sudo apt-get install php5-yaf
至于PECL的安装方法,参考
pecl install yaf
安装成功后别忘记重启APACHE,使新安装的PHP插件生效:
sudo /etc/init.d/apache2 restart
或
sudo service apache2 restart
2. 测试
安装成功后可以测试一下,参照http://www.laruence.com/manual/,建立目录结构如下:
- public
- index.php
- css
- js
- img
- conf
- application.ini
- applicaion
- controllers
- Index.php
- library
- models
- modules
- plugins
- views
- index
- index.phtml
- index
- controllers
其中:
index.php
<?phpdefine("APP_PATH",realpath(dirname(__FILE__).'/../'));$app = new Yaf_Application(APP_PATH.'/conf/application.ini');$app->run();?>
application.ini
[product]application.directory=APP_PATH"/application/"
Index.php
<?phpclass IndexController extends Yaf_Controller_Abstract{ public function indexAction(){ $this->getView()->assign("content","Hello, world!"); }}?>
index.phtml
<html> <head> <title>Test Page</title> </head> <body> <?php echo $content?> </body></html>
测试结果:
- Yaf的安装与Hello,world测试
- Yaf之Hello World
- yaf--Hello World
- node的安装与hello world
- Hello World (hadoop-eclipse插件安装与测试)
- yaf框架下编写Hello World程序
- yaf框架学习第一篇hello world
- yaf框架学习第一篇hello world
- PHP安装加载yaf扩展,并用自动生成目录实现hello world程序
- NodeJs的安装 Hello World!
- Ruby开发工具的安装与“Hello World”
- Yaf安装与部署
- Yaf安装与部署
- processing-3.2.1安装与hello world
- golang 环境安装与hello world
- Phalcon Hello World Benchmark(Hello World测试)
- php yaf扩展安装不成功的原因之一yaf版本与操作系统位数不匹配
- mac安装apache的mod_wsgi模块错误总结以及hello world测试
- java反射详解
- iOS实现七牛多图片、文件上传和下载
- mybatis-generator自动生成器插件使用详解
- 第十天: 定时器、看门狗、PWM、蜂鸣器、RTC原理及代码实战
- English Daily - August 13,2016-Letty
- Yaf的安装与Hello,world测试
- 九度oj--1003和1049
- python的import与from...import的不同之处
- Nginx简介、安装
- docker实践入门之六
- Java俄罗斯方块
- 一篇文章教你MongoDB安装及启动
- nova 部署
- 第十一天: SD卡原理分析及SD卡启动详解