LAMP下安装phalcon
2014-11-26 00:00
393 查看
摘要: 按照Phalcon的英文文档,安装开源php架构环境phalcon
linux版本为CentOS6.5
安装必须的工具
yum install php-devel pcre-devel gcc make
安装git
yum install git
git到新版本的phalcon,并且编译安装
git clone --depth=1 git://github.com/phalcon/cphalcon.git
cd cphalcon/build
sudo ./install
安装Notes
在httpd.conf中修改你的主目录为/var/www/test
添加
<IfModule mod_rewrite.c>
<Directory "/var/www/test">
RewriteEngine on
RewriteRule ^$ public/ [L]
RewriteRule (.*) public/$1 [L]
</Directory>
<Directory "/var/www/test/public">
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php?_url=/$1 [QSA,L]
</Directory>
</IfModule>
在test下搭建自己的一个测试工程
结构如下
test/
app/
controllers/
models/
views/
public/
css/
img/
js/
index.php
index.php内容
8.添加一个controller
页面会显示一个hello!
搭建成功
linux版本为CentOS6.5
安装必须的工具
yum install php-devel pcre-devel gcc make
安装git
yum install git
git到新版本的phalcon,并且编译安装
git clone --depth=1 git://github.com/phalcon/cphalcon.git
cd cphalcon/build
sudo ./install
安装Notes
在httpd.conf中修改你的主目录为/var/www/test
添加
<IfModule mod_rewrite.c>
<Directory "/var/www/test">
RewriteEngine on
RewriteRule ^$ public/ [L]
RewriteRule (.*) public/$1 [L]
</Directory>
<Directory "/var/www/test/public">
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php?_url=/$1 [QSA,L]
</Directory>
</IfModule>
在test下搭建自己的一个测试工程
结构如下
test/
app/
controllers/
models/
views/
public/
css/
img/
js/
index.php
index.php内容
<?php try { //Register an autoloader $loader = new \Phalcon\Loader(); $loader->registerDirs(array( ’../app/controllers/’, ’../app/models/’ ))->register(); //Create a DI $di = new Phalcon\DI\FactoryDefault(); //Setup the view component $di->set(’view’, function(){ $view = new \Phalcon\Mvc\View(); $view->setViewsDir(’../app/views/’); return $view; }); //Setup a base URI so that all generated URIs include the "tutorial" folder $di->set(’url’, function(){ $url = new \Phalcon\Mvc\Url(); $url->setBaseUri(’/tutorial/’); return $url; }); //Handle the request $application = new \Phalcon\Mvc\Application($di); echo $application->handle()->getContent(); } catch(\Phalcon\Exception $e) { echo "PhalconException: ", $e->getMessage(); }
8.添加一个controller
<?php class IndexController extends \Phalcon\Mvc\Controller { public function indexAction() { echo "<h1>Hello!</h1>"; } }
页面会显示一个hello!
搭建成功
相关文章推荐
- ubuntu7.04下最简单的安装lamp+phpmyadmin方法
- centos6.5 编译安装lamp以及相关错误的解决方法
- LAMP环境安装简介(php+mysql)
- 在源码安装的LAMP环境中搭建Nagios
- 周末lamp班学员webwlsong 送红旗6光盘及其安装手册
- Ubuntu8.04安装LAMP
- Ubuntu7.10下LAMP的安装与配置(phphot)
- LAMP 组合的安装
- RHEL4安装LAMP
- LAMP安装手记
- LAMP安装配置手记
- LAMP的安装与配置(二)
- LAMP环境安装简介
- LAMP全新安装 Linux+Apache+MySQL+PHP+phpMyadmin+Zend
- [导入]LAMP架构下安装Drupal
- 在UBUNTU 6.06(Dapper Drake)安装LAMP
- LAMP组合的安装
- 在ubuntu7.10 Desktop版本中安装LAMP的命令
- 为什么我安装网站服务器(Ubuntu+LAMP)到%92就不动了呢?
- 在Fedora Core 8半手动上安装LAMP