LoginSignup
2
1

More than 5 years have passed since last update.

PHP7.1でPhalconを使う

Posted at

Environment

OS : CentOS 7.3
PHP : 7.1.4
Phalcon : 3.1.2
Phalcon DevTools : 3.2.0

Action

外部リポジトリのインストール

# yum install -y epel-release
# rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-7.rpm

PHP7.1パッケージのインストール

  • 7.1のPHPパッケージの確認
# yum info --enablerepo=remi-php71 php71*
  • インストールしたPHPまわりのパッケージたち
yum list installed | grep php

php71.x86_64                     1.0-1.el7.remi                 @remi-safe
php71-php-cli.x86_64             7.1.4-1.el7.remi               @remi-safe
php71-php-common.x86_64          7.1.4-1.el7.remi               @remi-safe
php71-php-fpm.x86_64             7.1.4-1.el7.remi               @remi-safe
php71-php-json.x86_64            7.1.4-1.el7.remi               @remi-safe
php71-php-mbstring.x86_64        7.1.4-1.el7.remi               @remi-safe
php71-php-mcrypt.x86_64          7.1.4-1.el7.remi               @remi-safe
php71-php-pdo.x86_64             7.1.4-1.el7.remi               @remi-safe
php71-php-pecl-scrypt.x86_64     1.4.2-3.el7.remi               @remi-safe
php71-php-phalcon3.x86_64        3.1.2-1.el7.remi               @remi-safe
php71-php-tidy.x86_64            7.1.4-1.el7.remi               @remi-safe
php71-php-xml.x86_64             7.1.4-1.el7.remi               @remi-safe
php71-php-xmlrpc.x86_64          7.1.4-1.el7.remi               @remi-safe
php71-runtime.x86_64             1.0-1.el7.remi                 @remi-safe

Phalconのインストール

リポジトリの追加

# 安定板
curl -s https://packagecloud.io/install/repositories/phalcon/stable/script.rpm.sh | sudo bash

リポジトリを追加すればyumコマンドで普通にPhalconをインストールできます

Warning: Phalcon\Mvc\View\Engine\Volt\Compiler::compileFile(...)
failed to open stream: Permission denied in ...
Volt directory can't be written phalcon

URLを叩いて上のwarningが表示される場合は

# chmod 777 -R cache

を試してみましょう

コマンドラインツールのインストール

git clone https://github.com/phalcon/phalcon-devtools
cd phalcon-devtools
. ./phalcon.sh

ツールを clone したフォルダに移動し、”. ./phalcon.sh” を実行
コマンドの最初のドットを忘れないようにしましょう

  • シェルを実行するとPHP Exceptionが出る場合
    masterブランチではなく、3.2.xブランチに切り替えてからシェルを実行してみましょう
    PHP7系を使っていると発生する?

  • スクリプト phalcon.php へのシンボリックリンクを作成

ln -s ~/phalcon-devtools/phalcon.php /usr/bin/phalcon
chmod ugo+x /usr/bin/phalcon
phalcon commands
Phalcon DevTools (3.2.0 ALPHA 1)

Available commands:
  info             (alias of: i)
  commands         (alias of: list, enumerate)
  controller       (alias of: create-controller)
  module           (alias of: create-module)
  model            (alias of: create-model)
  all-models       (alias of: create-all-models)
  project          (alias of: create-project)
  scaffold         (alias of: create-scaffold)
  migration        (alias of: create-migration)
  webtools         (alias of: create-webtools)
  console          (alias of: shell, psysh)

phalconコマンドのコマンドリストが表示されれば完了です

2
1
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
2
1