Cakephp 3.5 설치

13149 단어 아파치cakephp3

Cakephp 설치



OS: centOS 6.9

cakephp를 설치합니다.

우선 php 5.6 이상이 조건이므로 그것을 설치합니다.

우선 EPEL 리포지토리 등록
sudo yum install -y epel-release

remi 리포지토리 등록
sudo rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-6.rpm

php 5.6 설치


sudo yum install --enablerepo=remi --enablerepo=remi-php56 -y php php-opcache php-devel php-mbstring php-mcrypt php-mysqlnd php-phpunit-PHPUnit php-pecl-xdebug php-pecl-xhprof

php intl 설치
sudo yum install --enablerepo=remi --enablerepo=remi-php56 -y php-intl

php의 timezone을 지정합니다.
sudo vim /etc/php.ini 

php.ini 왼쪽 파일을 편집하고 timezonex를 Asia/Tokyo로 변경합니다.

[Date]
 887 ; Defines the default timezone used by the date functions
 888 ; http://php.net/date.timezone
 889 date.timezone = "Asia/Tokyo"



Cakephp의 공식 사이트에는 apache를 추천하고 있었으므로,

Apache 설치



Apache를 설치해보십시오.
sudo yum install -y httpd httpd-devel

설치 완료로 자동 시작 on
sudo chkconfig httpd on

Apache conf 파일 편집
vim /etc/httpd/conf/httpd.conf
#ServerName www.example.com:80
ServerName 190.45.23.56:80 IPアドレスとか、ドメインあればドメインとか

포트를 지정하는 것이 좋습니다.
#    Options Indexes FollowSymLinks
332      Options Includes ExecCGI FollowSymLinks <- CGI,SSIの許可

339 #    AllowOverride None
 340      AllowOverride All <- .htaccessの許可

498 #LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined <- 長すぎるURI(414エラー)はログに記録しない
 499 LogFormat "%h %l %u %t \"%!414r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined

558 <Directory "/var/www/icons">
 559 #    Options Indexes MultiViews FollowSymLinks
 560     Options MultiViews <-  ← iconsディレクトリのファイル一覧を表示しないようにする
 561     AllowOverride None
 562     Order allow,deny
 563     Allow from all
 564 </Directory>

1015 #</VirtualHost>
1016 
1017 TraceEnable off <- traceメソッドを無効化
1018 


위의 느낌으로 설정합니다.

Apache 구문 검사
``
httpd -t
Syntax OK

サーバー起動

sudo service httpd restart
Stopping httpd: [ OK ]
Starting httpd: [ OK ]
``

성공했습니다.
ლ( ╹ε╹ლ)

iptables 방화벽 확인



방화벽에 구멍을 뚫자
80번 포트 드릴링
 sudo vi /etc/sysconfig/iptables

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


위의 한 줄을 추가할 수 있다면 위와 같이 22번 포트가 열려 있거나 포트적인 부분 같은 곳에 기술하면 알기 쉬울까 생각됩니다.

-A INPUT -m state --state NEW -m tcp -p tcp --dport 22 -j ACCEPT

토카

그 후 재부팅
sudo service iptables restart
iptables: Setting chains to policy ACCEPT: filter          [  OK  ]
iptables: Flushing firewall rules:                         [  OK  ]
iptables: Unloading modules:                               [  OK  ]
iptables: Applying firewall rules:                         [  OK  ]


열려 있는지 확인합니다.

글쎄, 열려있어, 열려 있지 않으면, 다시 한번 iptables를 확인 해요.
netstat -ant | grep 80
tcp        0      0 0.0.0.0:80                  0.0.0.0:*                   LISTEN  

우선 여기에서 WEB 서버가 기동하고 있어,
브라우저에서 볼 수 있는지 확인합니다.

ServerName에서 지정한 대로 브라우저에서 두드립니다. 페치!

표시되면 좋습니다.

composer 설치



여기에 composer 되는 php 관련 패키지 관리 시스템을 설치,
테마는 지휘자라고합니다.
아래 공식 사이트
htps : // 게이 t이 m 포세 r. rg/
curl -s https://getcomposer.org/installer | php
All settings correct for using Composer
Downloading...

Composer (version 1.5.1) successfully installed to: /var/www/html/composer.phar
Use it: php composer.phar
ls -a
.  ..  composer.phar <- phpの実行形式ファイルjar的な感じだそうでアーカイブ形式だそうです、解凍できます。
sudo mv composer.phar /usr/local/bin/composer <- bin 直下に移動リネームします。使いやすいので、
composerで呼べます。

composer 실행합니다.
composer
   ______
  / ____/___  ____ ___  ____  ____  ________  _____
 / /   / __ \/ __ `__ \/ __ \/ __ \/ ___/ _ \/ ___/
/ /___/ /_/ / / / / / / /_/ / /_/ (__  )  __/ /
\____/\____/_/ /_/ /_/ .___/\____/____/\___/_/
                    /_/
Composer version 1.5.1 2017-08-09 16:07:22

Usage:
  command [options] [arguments]

Options:
  -h, --help                     Display this help message
  -q, --quiet                    Do not output any message
  -V, --version                  Display this application version
      --ansi                     Force ANSI output
      --no-ansi                  Disable ANSI output
  -n, --no-interaction           Do not ask any interactive question
      --profile                  Display timing and memory usage information
      --no-plugins               Whether to disable plugins.
  -d, --working-dir=WORKING-DIR  If specified, use the given directory as working directory.
  -v|vv|vvv, --verbose           Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug

Available commands:
  about           Shows the short information about Composer.
  archive         Creates an archive of this composer package.
  browse          Opens the package's repository URL or homepage in your browser.
  clear-cache     Clears composer's internal package cache.
  clearcache      Clears composer's internal package cache.
  config          Sets config options.
  create-project  Creates new project from a package into given directory.
  depends         Shows which packages cause the given package to be installed.
  diagnose        Diagnoses the system to identify common errors.
  dump-autoload   Dumps the autoloader.
  dumpautoload    Dumps the autoloader.
  exec            Executes a vendored binary/script.
  global          Allows running commands in the global composer dir ($COMPOSER_HOME).
  help            Displays help for a command
  home            Opens the package's repository URL or homepage in your browser.
  info            Shows information about packages.
  init            Creates a basic composer.json file in current directory.
  install         Installs the project dependencies from the composer.lock file if present, or falls back on the composer.json.
  licenses        Shows information about licenses of dependencies.
  list            Lists commands
  outdated        Shows a list of installed packages that have updates available, including their latest version.
  prohibits       Shows which packages prevent the given package from being installed.
  remove          Removes a package from the require or require-dev.
  require         Adds required packages to your composer.json and installs them.
  run-script      Runs the scripts defined in composer.json.
  search          Searches for packages.
  self-update     Updates composer.phar to the latest version.
  selfupdate      Updates composer.phar to the latest version.
  show            Shows information about packages.
  status          Shows a list of locally modified packages.
  suggests        Shows package suggestions.
  update          Updates your dependencies to the latest version according to composer.json, and updates the composer.lock file.
  validate        Validates a composer.json and composer.lock.
  why             Shows which packages cause the given package to be installed.
  why-not         Shows which packages prevent the given package from being installed.

위와 같은 느낌으로 출력되면 패스가 지나면서 composer에서 사용할 수 있습니다.

Cakephp 설치



문서 루트의 디렉토리 권한을 변경합니다.
sudo chmod composerを実行するユーザーの名前:左記同文 ./html/
[ami@ik1-316-18051 html]$ composer create-project --prefer-dist cakephp/app ./
Installing cakephp/app (3.5.0)
  - Installing cakephp/app (3.5.0): Downloading (100%)         
Created project in ./
Loading composer repositories with package information
Updating dependencies (including require-dev)
Package operations: 39 installs, 0 updates, 0 removals
  - Installing cakephp/plugin-installer (1.0.0): Downloading (100%)         
  - Installing aura/intl (3.0.0): Downloading (100%)         
  - Installing mobiledetect/mobiledetectlib (2.8.25): Downloading (100%)         
  - Installing psr/http-message (1.0.1): Downloading (100%)         
  - Installing zendframework/zend-diactoros (1.5.0): Downloading (100%)         
  - Installing psr/log (1.0.2): Downloading (100%)         
  - Installing cakephp/chronos (1.1.2): Downloading (100%)         
  - Installing cakephp/cakephp (3.5.0): Downloading (100%)         
  - Installing symfony/polyfill-mbstring (v1.5.0): Downloading (100%)         
  - Installing symfony/yaml (v3.3.6): Downloading (100%)         
  - Installing symfony/debug (v3.3.6): Downloading (100%)         
  - Installing symfony/console (v3.3.6): Downloading (100%)         
  - Installing symfony/filesystem (v3.3.6): Downloading (100%)         
  - Installing symfony/config (v3.3.6): Downloading (100%)         
  - Installing robmorgan/phinx (v0.8.1): Downloading (100%)         
  - Installing cakephp/migrations (1.7.1): Downloading (100%)         
  - Installing m1/env (2.1.0): Downloading (100%)         
  - Installing josegonzalez/dotenv (2.1.0): Downloading (100%)         
  - Installing jakub-onderka/php-console-color (0.1): Downloading (100%)         
  - Installing jakub-onderka/php-console-highlighter (v0.3.2): Downloading (100%)         
  - Installing dnoegel/php-xdg-base-dir (0.1): Downloading (100%)         
  - Installing nikic/php-parser (v3.1.0): Downloading (100%)         
  - Installing symfony/var-dumper (v3.3.6): Downloading (100%)         
  - Installing psy/psysh (v0.8.11): Downloading (100%)         
  - Installing jdorn/sql-formatter (v1.2.17): Downloading (100%)         
  - Installing symfony/process (v3.3.6): Downloading (100%)         
  - Installing symfony/finder (v3.3.6): Downloading (100%)         
  - Installing seld/phar-utils (1.0.1): Downloading (100%)         
  - Installing seld/jsonlint (1.6.1): Downloading (100%)         
  - Installing seld/cli-prompt (1.0.3): Downloading (100%)         
  - Installing justinrainbow/json-schema (5.2.1): Downloading (100%)         
  - Installing composer/spdx-licenses (1.1.6): Downloading (100%)         
  - Installing composer/semver (1.4.2): Downloading (100%)         
  - Installing composer/ca-bundle (1.0.7): Downloading (100%)         
  - Installing composer/composer (1.5.1): Downloading (100%)         
  - Installing cakephp/debug_kit (3.11.0): Downloading (100%)         
  - Installing cakephp/bake (1.4.1): Downloading (100%)         
  - Installing squizlabs/php_codesniffer (3.0.2): Downloading (100%)         
  - Installing cakephp/cakephp-codesniffer (3.0.1): Downloading (100%)         
cakephp/app suggests installing markstory/asset_compress (An asset compression plugin which provides file concatenation and a flexible filter system for preprocessing and minification.)
cakephp/app suggests installing dereuromark/cakephp-ide-helper (After baking your code, this keeps your annotations in sync with the code evolving from there on for maximum IDE and PHPStan compatibility.)
cakephp/app suggests installing phpunit/phpunit (Allows automated tests to be run without system-wide install.)
cakephp/cakephp suggests installing lib-ICU (The intl PHP library, to use Text::transliterate() or Text::slug())
symfony/console suggests installing symfony/event-dispatcher ()
m1/env suggests installing m1/vars (For loading of configs)
symfony/var-dumper suggests installing ext-symfony_debug ()
psy/psysh suggests installing ext-pdo-sqlite (The doc command requires SQLite to work.)
psy/psysh suggests installing hoa/console (A pure PHP readline implementation. You'll want this if your PHP install doesn't already support readline or libedit.)
cakephp/debug_kit suggests installing ext-sqlite (DebugKit needs to store panel data in a database. SQLite is simple and easy to use.)
Writing lock file
Generating autoload files
> Cake\Composer\Installer\PluginInstaller::postAutoloadDump
> App\Console\Installer::postInstall
Created `config/app.php` file
Set Folder Permissions ? (Default to Y) [Y,n]? Y
Permissions set on /var/www/html/tmp/cache
Permissions set on /var/www/html/tmp/cache/models
Permissions set on /var/www/html/tmp/cache/persistent
Permissions set on /var/www/html/tmp/cache/views
Permissions set on /var/www/html/tmp/sessions
Permissions set on /var/www/html/tmp/tests
Permissions set on /var/www/html/tmp
Permissions set on /var/www/html/logs
Updated Security.salt value in config/app.php

완료입니다.

ServerName에 지정된 Url을 브라우저에서 읽습니다.
이번에는 3.5이므로,

아래와 같이 되어 있으면 성공입니다.

좋은 웹페이지 즐겨찾기