LoginSignup
3
3

More than 5 years have passed since last update.

CentOS 7.3 で pear install した Symfony 1.4 を動かすまでのメモ

Last updated at Posted at 2017-04-15

ブログからの転載

今回訳あって Symfony 1.4 を触ることになり、手元で Symfony 1.4 を勉強する環境を作りました。

少し手こずったのでメモを残します。

前提条件

  • Hyper-V に CentOS 7.3.1611 をセットアップ済み
  • SELinux は disabled
  • firewalld は停止済み
  • Apache, MariaDB は導入済み

yum で必要なパッケージをインストール

root ユーザーで作業を行います

yum install php php-cli php-mbstring php-pear php-pdo php-mysql

pear で Symfony をインストール

root ユーザーで作業を行います

pear upgrade PEAR
pear channel-discover pear.symfony-project.com
pear install symfony/symfony-1.4.20

Symfony のセットアップ

一般ユーザー(ここでは hoge さん)で作業を行います。

cd ~
mkdir symfony_learn
cd symfony_learn
symfony generate:project symfony_learn
symfony generate:app frontend

frontend_dev.php で IP アドレスを指定されている部分をコメントアウトしました

vim web/frontend_dev.php
~/symfony_learn/frontend_dev.php
<?php

// this check prevents access to debug front controllers that are deployed by accident to production servers.
// feel free to remove this, extend it or make something more sophisticated.
//if (!in_array(@$_SERVER['REMOTE_ADDR'], array('127.0.0.1', '::1')))
//{
//  die('You are not allowed to access this file. Check '.basename(__FILE__).' for more information.');
//}

require_once(dirname(__FILE__).'/../config/ProjectConfiguration.class.php');

$configuration = ProjectConfiguration::getApplicationConfiguration('frontend', 'dev', true);
sfContext::createInstance($configuration)->dispatch();

Apache の設定

root ユーザーで作業を行います

vim /etc/httpd/conf.d/dev.conf

dev.conf は次の記述にします

/etc/httpd/conf.d/dev.conf
NameVirtualHost *:8080
Listen 8080

<VirtualHost *:8080>
  DocumentRoot /home/hoge/symfony_learn/web
  DirectoryIndex index.php

  Alias /sf /usr/share/pear-data/symfony/web/sf

  <Directory "/home/hoge/symfony_learn/web">
    AllowOverride All
    Require all granted
  </Directory>

  <Directory "/usr/share/pear-data/symfony/web/sf">
    AllowOverride All
    Require all granted
  </Directory>
</VirtualHost>

Apache に設定を反映させます

systemctl restart httpd

動作確認

  • http://<ゲスト OS の IP アドレス>:8080/index.php/
    normal.png

  • http://<ゲスト OS の IP アドレス>:8080/frontend_dev.php/
    frontend_dev.png

参考 URL

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