phalcon

阿里云linux服务器安装Phalcon-----\"phalcon Volt directory can't be written\" \"gcc: internal compiler error: Killed (program cc1)\"

隐身守侯 提交于 2020-02-26 01:26:33
这里特别蛋疼的一件事是官方 英文文档 和 中文文档 命令参数略有不同 中文文档: 1 //通用平台下安装指定的软件包: 2 sudo yum install git gcc make pcre-devel php-devel 3 4 //编译 5 git clone git://github.com/phalcon/cphalcon.git 6 cd cphalcon/build 7 sudo ./install 8 9 //添加扩展到你的php配置文件 10 #Centos/RedHat: Add a file called phalcon.ini in /etc/php.d/ with this content: 11 extension=phalcon.so 英文文档: //We need some packages previously installed: sudo yum install php-devel php-mysqlnd gcc libtool //To create the extension from C source follow these steps: git clone --depth=1 git://github.com/phalcon/cphalcon.git cd cphalcon/build sudo ./install //Add the

安装Phalcon报错:gcc: Internal error: Killed (program cc1)

家住魔仙堡 提交于 2020-02-26 01:26:08
起因 安装Phalcon可以参考github上面的 README.md 下面是我在阿里云ECS服务器上面执行命令的过程: # 安装依赖 sudo yum install php-devel pcre-devel gcc make re2c # 编译安装 git clone git://github.com/phalcon/cphalcon.git cd cphalcon/build # 这里最好指定一下php的具体路径,以免有多个php版本的时候安装到别的版本里面去了 # 可以用php打印phpinfo()信息查看当前php版本和路径信息 sudo ./install --phpize /alidata/server/php/bin/phpize --php-config /alidata/server/php/bin/php-config 然后发现报错如下: gcc: Internal error: Killed (program cc1) bing搜索一下,发现有人遇到过类似问题,原因是阿里云ECS内存不足并且默认关闭了swap引起的。 于是copy and execute,问题解决: #创建交换分区目录 sudo mkdir -p /var/cache/swap/ #创建用于交换分区的文件。count=512 代表设置512MB大小swap文件 sudo dd if=/dev

Override layout in Phalcon

一曲冷凌霜 提交于 2020-02-23 07:51:37
问题 I have found out how to do a view override in Phalcon with the help of this: https://stackoverflow.com/a/19941928/74651 The problem is that it uses this method for the layout to, but if the directory does not exists on the original viewpath it does enter in this method. Where does phalcon checks the directory for the layout and how to override it? 回答1: Here and kind of here. So, you could do three things. First, change the layout dir, second, just set the layout, or third, change both :)

Override layout in Phalcon

邮差的信 提交于 2020-02-23 07:51:06
问题 I have found out how to do a view override in Phalcon with the help of this: https://stackoverflow.com/a/19941928/74651 The problem is that it uses this method for the layout to, but if the directory does not exists on the original viewpath it does enter in this method. Where does phalcon checks the directory for the layout and how to override it? 回答1: Here and kind of here. So, you could do three things. First, change the layout dir, second, just set the layout, or third, change both :)

How to implement \Phalcon\Mvc\Model::findIn()?

大兔子大兔子 提交于 2020-01-30 12:15:30
问题 Fairly simple question, but I can't seem to find anything about it. I've got a set of ids, and I need to find all matching records. So I'd like to query : $records = MyModel::findIn([1,2,3,4]); But I don't know how to implement it. Any idea ? 回答1: Check out the Phalcon\Mvc\Model\Criteria, in the inWhere method. You could create a new model's method like: public static function findIn(array $identifiers) { return self::query() ->inWhere('id', $identifiers) ->execute(); } 来源: https:/

How to implement \Phalcon\Mvc\Model::findIn()?

 ̄綄美尐妖づ 提交于 2020-01-30 12:15:25
问题 Fairly simple question, but I can't seem to find anything about it. I've got a set of ids, and I need to find all matching records. So I'd like to query : $records = MyModel::findIn([1,2,3,4]); But I don't know how to implement it. Any idea ? 回答1: Check out the Phalcon\Mvc\Model\Criteria, in the inWhere method. You could create a new model's method like: public static function findIn(array $identifiers) { return self::query() ->inWhere('id', $identifiers) ->execute(); } 来源: https:/

理解 PHP 依赖注入

落爺英雄遲暮 提交于 2020-01-22 22:48:14
Laravel框架的依赖注入确实很强大,并且通过容器实现依赖注入可以有选择性的加载需要的服务,减少初始化框架的开销,下面是我在网上看到的一个帖子,写的很好拿来与大家分享,文章从开始按照传统的类设计数据库连接一直到通过容器加载服务这个高度解耦的设计展示了依赖注入的强大之处,值得我们借鉴和学习。 -----------------------------------------------------------分割线下面是大牛的原文----------------------------------------------------------   首先,我们假设,我们要开发一个组件命名为SomeComponent。这个组件中现在将要注入一个数据库连接。在这个例子中,数据库连接在component中被创建,这种方法是不切实际的,这样做的话,我们将不能改变数据库连接参数及数据库类型等一些参数。 1 <?php 2 3 class SomeComponent 4 { 5 6 /** 7 * The instantiation of the connection is hardcoded inside 8 * the component so is difficult to replace it externally 9 * or change its behavior 10 */ 11

Missing 'className' parameter

Deadly 提交于 2020-01-17 06:22:03
问题 I am working on a old project change request and the project was developed in phalcon 1.2.6 verson. When I am trying to execute the application the application returns an error. After doing some R&D I found that the system did not find the config key from the $di object. When I am trying to print the $di object it's printing properly with key config. But when trying to access the config key, I am unable to access it. When the system tries to execute the below code, it throws an exception. $di

Missing 'className' parameter

早过忘川 提交于 2020-01-17 06:21:18
问题 I am working on a old project change request and the project was developed in phalcon 1.2.6 verson. When I am trying to execute the application the application returns an error. After doing some R&D I found that the system did not find the config key from the $di object. When I am trying to print the $di object it's printing properly with key config. But when trying to access the config key, I am unable to access it. When the system tries to execute the below code, it throws an exception. $di

Phalcon very slow using Phalcon\Http\Response();

半城伤御伤魂 提交于 2020-01-14 04:39:26
问题 I am experiencing a very strange issue with Phalcon. Whenever I use Response inside a controller the framework becomes very slow. Here is my simple controller: <?php // file: app/controllers/TestController.php use Phalcon\Mvc\View; class TestController extends ControllerBase { private $response; public function initialize() { $this->view->setRenderLevel(View::LEVEL_NO_RENDER); $this->response = new Phalcon\Http\Response(); $this->response->setStatusCode(200, "OK"); } public function