LoginSignup
0
0

More than 5 years have passed since last update.

elementary OS FreyaにPHP7 + Nginx + MySQL+Phalconのインストール

Last updated at Posted at 2016-09-28

普通にUbuntu14.04と同じ。

「add-apt-repopsitory」が入ってなければ

$ sudo apt-get install python-software-properties

PHP7(このリポジトリで7.1もいけると思います。)

$ sudo add-apt-repository ppa:ondrej/php
$ sudo apt-get uppdate
$ sudo apt-get install php7.0 php7.0-fpm

その他PHP関係(apt-cache searchの結果から必要なものをチョイス)

$ sudo apt-cache search php7-*
$ sudo apt-get install php7.0-common php7.0-curl php7.0-mcrypt php7.0-json php7.0-mbstring

後は必要になったら臨機応変に。

Nginx

$ echo "deb http://nginx.org/packages/mainline/ubuntu/ trusty nginx" >> /etc/apt/sources.list
$ echo "deb-src http://nginx.org/packages/mainline/ubuntu/ trusty nginx" >> /etc/apt/sources.list
$ curl http://nginx.org/keys/nginx_signing.key | apt-key add -
$ sudo apt-get update
$ sudo apt-get install nginx

Mysql

$ sudo add-apt-repository ppa:ondrej/mysql-5.6
$ sudo apt-get update
$ sudo apt-get install mysql-server-5.6

php-fpmの設定

/etc/php7.0/fpm/php.ini の 760行付近

# cgi.fix_pathinfo=1

をコメントアウトし、さらに0へ変更

cgi.fix_pathinfo=0

ソケットのパーミッション設定

/etc/php/7.0/fpm/pool.d/www.conf

user = nginx
group = nginx

listen.owner = nginx
listen.gropu = nginx

Nginxの設定

location / {
  # root /usr/share/nginx/html; ここは自分の慣れた場所に変える
  root   /var/www/default/httpdocs;

  # 先頭にindex.php追加
  index  index.php index.html index.htm;
}


# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
# 以下のブロックをコメントアウトし変更
location ~ \.php {
  # ur[l]じゃない!ur[i]だ!
  try_files          $uri = 404;
  # root             html; コメントアウト
  fastcgi_index      index.php;
  fastcgi_pass       unix:/var/run/php/php7.0-fpm.sock


  include            fastcgi_params;
  fastcgi_param      SCRIPT_FILENAME /var/www/default/httpdocs$fastcgi_script_name;
}

80番ポート開く

$ sudo iptables -A INPUT -m state --state NEW -p tcp --dport 80 -j ACCEPT

Nginx・php-fpmの起動

$ sudo service nginx start
$ sudo service php7.0-fpm restart

Phalconインストール

$ curl -s https://packagecloud.io/install/repositories/phalcon/stable/script/deb.sh | sudo bash

URLに含まれた間違ったディストリ名を修正

/etc/apt/sources.list.d/phalcon_stable.list

# deb https://packagecloud.io/phalcon/stable/elementaryos/ freya main
# deb-src https://packagecloud.io/phalcon/stable/elementaryos/ freya main
deb https://packagecloud.io/phalcon/stable/ubuntu/ trusty main
deb-src https://packagecloud.io/phalcon/stable/ubuntu/ trusty main
$ sudo apt-get update
$ sudo apt-get install php7.0-phalcon

簡単になりすぎててシャンプー切れた。

0
0
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
0
0