既然 WordPress 都可以安裝成功了,那我們就繼續嘗試安裝 Laravel 吧!而且直接挑戰今年九月份剛出來的 Laravel 6.0 (LTS)。
安裝步驟
安裝 Composer
$ sudo php -r "copy('<https://getcomposer.org/installer>', 'composer-setup.php');"
$ sudo php -r "if (hash_file('sha384', 'composer-setup.php') === 'a5c698ffe4b8e849a443b120cd5ba38043260d5c4023dbf93e1558871f1f07f58274fc6f4c93bcfd858c6bd0775cd8d1') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"
Installer verified
$ sudo php composer-setup.php --install-dir=/usr/local/bin --filename=composer
All settings correct for using Composer
Downloading...
Composer (version 1.9.0) successfully installed to: /usr/bin/composer
Use it: php /usr/bin/composer
$ sudo php -r "unlink('composer-setup.php');"
$ sudo chmod +x /usr/local/bin/composer
補安裝缺的套件及 PHP 相關外褂
$ sudo yum install unzip php-pecl-zip php-mbstring php-xml
透過 Composer 下載 Laravel Installer
$ composer global require laravel/installer
編輯 ~/.bash_profile 檔案,將 laravel 所在目錄附加到 PATH 環境變數
$ vim .bash_profile
PATH=$PATH:$HOME/.local/bin:$HOME/bin:$HOME/.config/composer/vendor/bin
透過 Laravel Installer 安裝 Laravel,會建立一個 blog 資料夾,進行 Laravel 安裝
$ laravel new blog
啟動 PHP 內建伺服器,於本機開啟瀏覽器,網址輸入 http://localhost:8000 即可看到網頁
$ php artisan serve
其實,沒有做出來 ……