LoginSignup
5
5

More than 5 years have passed since last update.

SymfonyをCentOSにインストール

Last updated at Posted at 2015-07-10

SymfonyをCentOSにインストール

Symfony 2.7 を CentOS 6 または Centos 7 にセットアップする手順のまとめ。

環境構築

Yumリポジトリの追加

$ yum install http://rpms.famillecollet.com/enterprise/remi-release-`rpm -q --whatprovides /etc/redhat-release --qf '%{version}\n'`.rpm
$ yum install http://dev.mysql.com/get/mysql-community-release-el`rpm -q --whatprovides /etc/redhat-release --qf '%{version}\n'`-5.noarch.rpm

remiリポジトリーインストール時に依存性解消でEPELレポジトリーが自動的にインストールされる。

Apache/PHP/MySQLのインストール

$ yum install php php-xml php-mbstring php-mysql php-pecl-xdebug mysql-server --enablerepo=remi-php56
$ sed -i 's/;date\.timezone =/date.timezone = Asia\/Tokyo/' /etc/php.ini
$ sed -i 's/\[mysqld\]/\[mysqld\]\ncharacter-set-server = utf8/' /etc/my.cnf

Symfonyプロジェクトの作成

Composer でインストールすると一部のディレクトリーやファイルが展開されないなどの微妙な差異が生じる。

Composerでセットアップ

$ cd /var/www/html
$ curl -s https://getcomposer.org/installer | php
$ php composer.phar create-project symfony/framework-standard-edition my-project

Symfonyコマンドでセットアップ

$ cd /var/www/html
$ curl -LsS http://symfony.com/installer -o /usr/local/bin/symfony
$ chmod a+x /usr/local/bin/symfony
$ symfony new my-project

ブラウザーで確認

PHPビルトインサーバーで起動

$ cd my-project
$ php app/console server:run 192.168.56.101:8000
5
5
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
5
5