LoginSignup
49
44

More than 5 years have passed since last update.

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

Last updated at Posted at 2014-01-15

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.
49
44
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
49
44