masalibの日記

システム開発、運用と猫の写真ブログです

centos5.11でのWEBサーバー構築:(ZendFramework編)

centos5.11でのWEBサーバー構築:(PHP編) - masalibの日記
の続きで
PHPのインストールが終わったので
その他色々インストールする部分です

5・ZendFrameworkのインストール

5−1・ソースのダウンロードと解凍

1系と2系がありますが
1系です。理由は安定しているからです

最新版を下記のURLで確認してからダウンロードする
http://framework.zend.com/downloads/latest

cd /usr/local/src/
wget https://packages.zendframework.com/releases/ZendFramework-1.12.11/ZendFramework-1.12.11.tar.gz
tar zxvf ZendFramework-1.12.11.tar.gz

#解凍したファイルをライブラリがある場所に移動する
#移動しなくてもpathを設定するので問題ないはず・・

mv ZendFramework-1.12.11/ /usr/lib64/php/ZendFramework-1.12.11/
5−2・phpにパスを通す
vim /etc/php.ini

下記を追加する

include_path = ".:/usr/lib64/php/ZendFramework-1.12.11/library:/usr/lib64/php"

バージョンによってちがう

5−3・コマンドを通す
cd /usr/local/bin
cp /usr/lib64/php/ZendFramework-1.12.1/bin/zf* ./
mv zf.sh zf

/usr/local/binは実行しているユーザーによってことなるので
echo $PATHで確認する


コマンドの確認する

バージョンが返ってくる事を確認する

zf show version
5−4・Projectを作成する
#フォルダの移動
cd /var/www/

#プロジェクトの作成
zf create project xxxxx
5−5・apachehttpd.confにvhostの設定をする
vim /usr/local/apache2/conf/httpd.conf

Include conf/extra/site-configs/*
がなかったらたす

Listen 8080を追加する

vim /usr/local/apache2/conf/extra/site-configs/xxxxx.conf


下記の内容を追加する

NameVirtualHost *:8080

<virtualhost *:8080="">
   DocumentRoot "/var/www/xxxxx/public"
   
   #Access Log
   CustomLog "|/usr/local/apache2/bin/rotatelogs /var/log/httpd/access_log/xxxxx/access_log_%Y%m%d 86400 540" combined env=!no_log
   #Error Log
   ErrorLog "|/usr/local/apache2/bin/rotatelogs /var/log/httpd/error_log/xxxxx/error_log_%Y%m%d 86400 540"
   

   # This should be omitted in the production environment
   #SetEnv APPLICATION_ENV production

   <directory "="" var="" www="" xxxxx="" public"="">
       DirectoryIndex index.html index.php
       AllowOverride All
       Order allow,deny
       Allow from all
   </directory>

</virtualhost>

ログ出力用のフォルダを作成

mkdir /var/log/httpd/access_log/
mkdir /var/log/httpd/access_log/xxxxx/
mkdir /var/log/httpd/error_log/
mkdir /var/log/httpd/error_log/xxxxx/

service httpd configtest

問題なければ
service httpd reload

サイトにアクセスして確認する
下記の画面がでていたらOK
http://xxxxxx:8080/index.php
f:id:masalib:20150219153850j:plain