Help us understand the problem. What is going on with this article?

Phalcon PHP インストール (CentOS 6.5)

More than 5 years have passed since last update.

OSバージョン確認


$ cat /etc/redhat-release 
CentOS release 6.5 (Final)

gcc, php, php-devel のインストール

epelレポジトリ、remi レポジトリのインストール

$ sudo rpm -Uvh http://ftp.jaist.ac.jp/pub/Linux/Fedora/epel/6/i386/epel-release-6-8.noarch.rpm
$ sudo rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-6.rpm

gcc, php, php-devel のインストール

$ sudo yum -y install gcc make
$ sudo yum -y install php --enablerepo=remi
$ sudo yum -y install php-devel --enablerepo=remi

確認

$ php -v
PHP 5.4.24 (cli) (built: Jan  9 2014 07:32:12) 

Phalconソースの取得とインストール

git からソースをダウンロードするので、事前にgitのインストールが必要

$ git clone git://github.com/phalcon/cphalcon.git
$ cd cphalcon/build
$ sudo ./install

php.iniの設定

/etc/php.d/phalcon.ini を作成し下記を記述

extension=phalcon.so

インストールの確認

下記のように出力されればOK

$ php -i |grep Phalcon
Phalcon Framework => enabled
Phalcon Version => 1.2.5

プロジェクトの作成

Phalcon DevToolsを使って作ります。
※ DevTools は別途インストールが必要
参考: http://qiita.com/inouet/items/9a3ed3f028916f89053c

$ cd /vagrant/
$ phalcon project phalcon-sample

Phalcon DevTools (1.2.5)


  Success: Controller "index" was successfully created.  


  Success: Project "phalcon-sample" was successfully created.  

下記のような構造になります。

$ tree phalcon-sample/
phalcon-sample/
├── app
│   ├── config
│   │   └── config.php
│   ├── controllers
│   │   ├── ControllerBase.php
│   │   └── IndexController.php
│   ├── logs
│   ├── models
│   └── views
│       ├── index
│       │   └── index.phtml
│       ├── index.phtml
│       └── layouts
├── index.html
└── public
    ├── css
    ├── files
    ├── img
    ├── index.php
    ├── js
    └── temp

apache Vhostの設定

/etc/httpd/conf.d/vhost.conf に 設定
vagrant1 というホストでアクセスできるように設定します。

httpd.conf
<VirtualHost *:80>

    ServerAdmin admin@example.host
    DocumentRoot "/vagrant/phalcon-sample/public"
    DirectoryIndex index.php
    ServerName vagrant1
    ServerAlias vagrant1


    <Directory "/vagrant/phalcon-sample/public">
        Options All
        AllowOverride All
        Allow from all

        RewriteEngine On
        RewriteCond %{REQUEST_FILENAME} !-d
        RewriteCond %{REQUEST_FILENAME} !-f
        RewriteRule ^(.*)$ index.php?_url=/$1 [QSA,L]
    </Directory>

</VirtualHost>

http://vagrant1/ にアクセス

Congratulations!

You're now flying with Phalcon.
Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Comments
No comments
Sign up for free and join this conversation.
If you already have a Qiita account
Why do not you register as a user and use Qiita more conveniently?
You need to log in to use this function. Qiita can be used more conveniently after logging in.
You seem to be reading articles frequently this month. Qiita can be used more conveniently after logging in.
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
ユーザーは見つかりませんでした