PHPãã¬ã¼ã ã¯ã¼ã¯ Laravel4 ã¤ã³ã¹ãã¼ã«
æè¿ã話é¡ã®PHPãã¬ã¼ã ã¯ã¼ã¯ã®Laravel4ãCentOSã«
ã¤ã³ã¹ãã¼ã«ãã¦ã¿ã
Laravelã®æ¦è¦
Laravelã¯ãããæè¿æ¥æ¿ã«äººæ°ã伸ã°ãã¦ããã欧米ã§äººæ°ã®PHPãã¬ã¼ã ã¯ã¼ã¯ã
ç¹å¾´ã¯ããã³ã¼ããèªã¿ããããæ¸ãããããã¨ã®ãã¨ã
ã¾ãå®éã«ã¤ã³ã¹ãã¼ã«ãã¦ã触ã£ã¦ã¿ãã®ãä¸çªãªã®ã§
ä»åã¯ã¤ã³ã¹ãã¼ã«ã¾ã§ã®æé ãã¾ã¨ãã¾ããã
ç°å¢
OS | CentOS release 6.5 |
PHP | 5.4.14 |
laravel | 4.1.24 |
Apache | 2.4.4 |
â» PHP 5.3以ä¸ã®å¿ è¦ãã
Composer ã¤ã³ã¹ãã¼ã«
Composerã¨ã¯ãã¢ããªã±ã¼ã·ã§ã³ãå¿
è¦ã¨ããå¤é¨ã©ã¤ãã©ãªã
ãã®ã¢ããªã±ã¼ã·ã§ã³åºæã®ç¶æ
ã§ä¸å
çã«ç®¡çãã¦ããããã¼ã«ã
Rubyã§ããã¨ããã®Bundlerçãªä½ç½®ã¥ãã
curl -sS https://getcomposer.org/installer | php
Project ä½æ
ä»åã¯åãããããããã«ãlaravel4ãã¨ããããã¸ã§ã¯ãåã§ä½æ
php composer.phar create-project laravel/laravel laravel4 --prefer-dist
å®è¡ãããã£ã¬ã¯ããªé ä¸ã«ãlaravel4ããä½æããã
ls -la laravel4/ .gitattributes .gitignore CONTRIBUTING.md app artisan bootstrap composer.json composer.lock phpunit.xml public readme.md server.php vendor
ã¨ãããã Git ã«è¿½å
cd laravel4 git init git add . git commit -a -m 'laravel4 first commit'
Configã®æ¥æ¬æéãæ¥æ¬èªè¨å®
vi app/config/app.php - 'timezone' => 'UTC', + 'timezone' => 'Asia/Tokyo', - 'locale' => 'en', + 'locale' => 'ja',
Apacheã®è¨å®
public以ä¸ã®.htaccessããã¾ãåä½ããªãã£ãã®ã§
.htaccessãã³ã¡ã³ãã¢ã¦ããã¦ãapacheã®confã«ä¸è¨ã追å
laravel4ããã¸ã§ã¯ãã®ã«ã¼ããã£ã¬ã¯ããªã¯ä»®ã§ã/var/wwwã
<VirtualHost *> ServerName *** DocumentRoot /var/www/laravel4/public <Directory /var/www/laravel4/public> RewriteEngine on RewriteCond $1 !^(index\.php) RewriteRule ^(.*)$ /index.php/$1 [L] Require all granted Options All -Indexes </Directory> </VirtualHost>
ã¢ã¯ã»ã¹ç¢ºèª
è¨å®ããURLã«ã¢ã¯ã»ã¹ãã¦ä¸è¨ç»åã表示ãããã
ã¤ã³ã¹ãã¼ã«ããApacheã®è¨å®ã¯å®äºï¼
ä»åã¯ã¤ã³ã¹ãã¼ã«ããApacehã®è¨å®ã¾ã§ã§ããã
ä»ã®ãã¬ã¼ã ã¯ã¼ã¯ã¨ã®æ¯è¼ããªãããããã©ã¼ãã³ã¹æ¸¬å®ã
ç°¡åãªãã¼ã¸ä½æãå¾ã
ãã£ã¦ã¿ããã¨æãã¾ãã
åèãµã¤ã