10月
06
- symfonyのプロジェクト作成
-
10月 6, 2008
//php the_content_rss('', FALSE, '', 68); ?>
symfonyの設定
$ mkdir localhost ← ディレクトリの作成
$ cd localhost/
プレロジェクトを作成していきます。
$ symfony init-project project_name ← プロジェクトの作成
>> dir+ /home/hogehoge/localhost/config
>> file+ /home/hogehoge/localhost/config/schema.yml
>> file+ /home/hogehoge/localhost/config/databases.yml
>> file+ /home/hogehoge/localhost/config/rsync_exclude.txt
>> file+ /home/hogehoge/localhost/config/properties.ini
>> file+ /home/hogehoge/localhost/c.../ProjectConfiguration.class.php
>> file+ /home/hogehoge/localhost/config/propel.ini
>> dir+ /home/hogehoge/localhost/doc
>> dir+ /home/hogehoge/localhost/log
>> dir+ /home/hogehoge/localhost/web
>> file+ /home/hogehoge/localhost/web/robots.txt
>> dir+ /home/hogehoge/localhost/web/js
>> file+ /home/hogehoge/localhost/web/.htaccess
>> dir+ /home/hogehoge/localhost/web/uploads
>> dir+ /home/hogehoge/localhost/web/uploads/assets
・
・
$ symfony init-app myproject ← アプリの指定の作成
Apacheの設定
# vi /etc/httpd/conf/httpd.conf ← Apacheの設定
ServerName localhost
DocumentRoot "/home/hogehoge/localhost/web"
DirectoryIndex index.php
Alias /sf "/usr/share/pear/data/symfony/web/sf"
#permit rewrite
AllowOverride All
allow from all
Apacheの再起動で、設定した画面にアクセスして下記の画面がでると設定完了

//php the_content_rss('', FALSE, '', 68); ?>
確認すべきこと
- symfonyはPHP5の環境でしか動きません
- pearが古いと動きません Version1.40以降
Pearのインストール
pearが入っているのかを確認する
yum list | grep pear
php-pear.noarch 1:1.4.9-4.el5.1 installed
php-pear-Auth-SASL.noarch 1.0.2-4.el5.centos extras
php-pear-DB.noarch 1.7.13-1.el5.centos extras
php-pear-Date.noarch 1.4.7-2.el5.centos extras
php-pear-File.noarch 1.2.2-1.el5.centos extras
php-pear-HTTP-Request.noarch 1.4.2-1.el5.centos extras
php-pear-Log.noarch 1.9.13-1.el5.centos extras
php-pear-MDB2.noarch 2.4.1-2.el5.centos extras
php-pear-MDB2-Driver-mysql.noarch 1.4.1-3.el5.centos extras
php-pear-Mail.noarch 1.1.14-1.el5.centos extras
php-pear-Mail-Mime.noarch 1.4.0-1.el5.centos extras
php-pear-Net-SMTP.noarch 1.2.10-1.el5.centos extras
php-pear-Net-Sieve.noarch 1.1.5-2.el5.centos extras
php-pear-Net-Socket.noarch 1.0.8-1.el5.centos extras
php-pear-Net-URL.noarch 1.0.15-1.el5.centos extras
上記のようにpearの一覧がでればインストールはされています。
入っていない場合は、インストールが必要です。
yum install pear
1.40以降でないと動かないので、pearのアップグレード
pear upgrade PEAR
symfonyのインストール
symfonyにチャンネルを追加
pear channel-discover pear.symfony-project.com
いよいよsymfonyをインストール
pear install symfony/symfony
symfony/symfony requires PHP extension "dom"
とエラーがでる、、、調べると「php-xml」が必要らしい
yum install php-xml
symfonyのインストールを再挑戦
pear install symfony/symfony
downloading symfony-1.1.1.tgz ...
Starting to download symfony-1.1.1.tgz (2,131,490 bytes)
..................................................done: 2,131,490 bytes
install ok: channel://pear.symfony-project.com/symfony-1.1.1
インストールの確認
symfony -v
Available tasks:
:help Displays help for a task (h)
:list Lists tasks
cache
:clear Clears the cache (cc, clear-cache)
configure
:author Configure project author
:database Configure database DSN
generate
:app Generates a new application (init-app)
:module Generates a new module (init-module)
:project Generates a new project (init-project)
:task Creates a skeleton class for a new task
i18n
:extract Extracts i18n strings from php files
:find Finds non "i18n ready" strings in an application
log
:clear Clears log files (log-purge)
:rotate Rotates an application log files (log-rotate)
plugin
:add-channel Add a new PEAR channel
:install Installs a plugin (plugin-install)
:list Lists installed plugins (plugin-list)
:uninstall Uninstalls a plugin (plugin-uninstall)
:upgrade Upgrades a plugin (plugin-upgrade)
project
:clear-controllers Clears all non production environment controllers (clear-controllers)
:deploy Deploys a project to another server (sync)
:disable Disables an application in a given environment (disable)
:enable Enables an application in a given environment (enable)
:freeze Freezes symfony libraries (freeze)
:permissions Fixes symfony directory permissions (permissions, fix-perms)
:unfreeze Unfreezes symfony libraries (unfreeze)
:upgrade1.1 Upgrade a symfony project to the 1.1 symfony release
propel
:build-all Generates Propel model, SQL and initializes the database (propel-build-all)
:build-all-load Generates Propel model, SQL, initializes database, and load data (propel-build-all-load)
:build-db Creates database for current model (propel-build-db)
:build-forms Creates form classes for the current model
:build-model Creates classes for the current model (propel-build-model)
:build-schema Creates a schema.xml from an existing database (propel-build-schema)
:build-sql Creates SQL for the current model (propel-build-sql)
:data-dump Dumps data to the fixtures directory (propel-dump-data)
:data-load Loads data from fixtures directory (propel-load-data)
:generate-crud Generates a Propel CRUD module (propel-generate-crud)
:init-admin Initializes a Propel admin module (propel-init-admin)
:insert-sql Inserts SQL for current model (propel-insert-sql)
:schema-to-xml Creates schema.xml from schema.yml (propel-convert-yml-schema)
:schema-to-yml Creates schema.yml from schema.xml (propel-convert-xml-schema)
test
:all Launches all tests (test-all)
:functional Launches functional tests (test-functional)
:unit Launches unit tests (test-unit)
とりあえず、完了!!