3
4

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Vagrant上のUbuntu16.0にPHP7+Phalcon2.1.0の開発環境を構築する

Posted at

Ubuntu 16.04 + PHP7.0.4 + nginx1.10.1 + MySQL 5.7.12 + Phalcon 2.1.0 の環境をVagrantに構築する

ホストOSがWindows10の場合だけ?
vagrant upするとipの固定化に失敗したため、VirtualBoxとVagrantは下記のバージョンにアップデート

##前提条件

  • HostOS:Windows 10
  • Vagrant 1.8.4
  • VirtualBox 5.0.22
  • Ubuntu 16.04(bento/ubuntu-16.04)

###Vagrant Box
vagrant boxの作成を行う。
boxはbento/ubuntu-16.04を使用

mkdir hoge
cd hoge
vagrant init bento/ubuntu-16.04

###Vagrantfileの設定
下記の箇所のコメントアウトを解除

Vagrantfile
config.vm.network "private_network", ip: "192.168.33.10"
Vagrantfile
  config.vm.provider "virtualbox" do |vb|
#   # Display the VirtualBox GUI when booting the machine
#   vb.gui = true
#
#   # Customize the amount of memory on the VM:
   vb.memory = "1024"
  end

###仮想マシン起動,sshログイン

vagrant up
vagrant ssh

###php等インストール
####パッケージリスト更新

sudo apt-get update

####インストール

sudo apt-get install -y php7.0-fpm php7.0-cli php7.0-curl php7.0-gd php7.0-intl php7.0-pgsql curl vim wget git

###Phalconのインストール

sudo apt-get install -y gcc make re2c libpcre3-dev php7.0-dev build-essential php7.0-zip

sudo curl -sS http://getcomposer.org/installer | sudo php
sudo mv composer.phar /usr/local/bin/composer

sudo composer global require "phalcon/zephir:dev-master" 

sudo composer require "phalcon/devtools" -d /usr/local/bin/ 
sudo ln -s /usr/local/bin/vendor/phalcon/devtools/phalcon.php /usr/bin/phalcon

sudo git clone https://github.com/phalcon/cphalcon.git -b 2.1.x --single-branch
cd cphalcon/
sudo ~/.composer/vendor/bin/zephir build --backend=ZendEngine3

sudo service php7.0-fpm restart

####phalcon.soの設定

sudo echo "extension=phalcon.so" >> /etc/php/7.0/mods-available/phalcon.ini
sudo ln -s /etc/php/7.0/mods-available/phalcon.ini /etc/php/7.0/fpm/conf.d/20-phalcon.ini
sudo ln -s /etc/php/7.0/mods-available/phalcon.ini /etc/php/7.0/cli/conf.d/20-phalcon.ini

sudo service php7.0-fpm restart

###nginxのインストール

curl http://nginx.org/keys/nginx_signing.key | sudo apt-key add -

sudo sh -c "echo 'deb http://nginx.org/packages/ubuntu/ xenial nginx' >> /etc/apt/sources.list"
sudo sh -c "echo 'deb-src http://nginx.org/packages/ubuntu/ xenial nginx' >> /etc/apt/sources.list"

sudo apt-get update
sudo apt-get install nginx

###MySQLのインストール

apt-get -y install mysql-server mysql-client

###参考

3
4
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
3
4

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?