cakePHPインストールでハマった話。(intl.so)
Laravelいろいろさわってましたが、とりあえずいろいろPHPフレームワーク触ってみることにしました。
というわけで、cakePHPやってみることに。
composerはインストール済みとします。
ドキュメントに従いインストール
cakePHPのクイックスタートガイドをもとに進めていきます。
webサーバのルートとなるディレクトリに移動。
ビルトインの簡易サーバもつかえるので、適当なディレクトリでいいと思います。
composerのcreate-projectコマンドでcakePHPプロジェクトを導入します。
$ composer create-project --prefer-dist cakephp/app test Problem 1 - cakephp/cakephp 3.1.7 requires ext-intl * -> the requested PHP extension intl is missing from your system. - cakephp/cakephp 3.1.6 requires ext-intl * -> the requested PHP extension intl is missing from your system. - cakephp/cakephp 3.1.5 requires ext-intl * -> the requested PHP extension intl is missing from your system. - cakephp/cakephp 3.1.4 requires ext-intl * -> the requested PHP extension intl is missing from your system. - cakephp/cakephp 3.1.3 requires ext-intl * -> the requested PHP extension intl is missing from your system. - cakephp/cakephp 3.1.2 requires ext-intl * -> the requested PHP extension intl is missing from your system. - cakephp/cakephp 3.1.1 requires ext-intl * -> the requested PHP extension intl is missing from your system. - cakephp/cakephp 3.1.0 requires ext-intl * -> the requested PHP extension intl is missing from your system. - Installation request for cakephp/cakephp ~3.1 -> satisfiable by cakephp/cakephp[3.1.0, 3.1.1, 3.1.2, 3.1.3, 3.1.4, 3.1.5, 3.1.6, 3.1.7].
なんかエラー出てるみたい。
どうも、intl
というPHP拡張が無いようです。
intlの導入
調べてみると、peclつかったりしないといけなそう。
CakePHP3.0をインストールしてみる(自分用めもめも - Qiita
うーん。
とりあえず、yumコマンドでintl
が無いか探してみる。
$ yum list | grep intl
php-intl.x86_64 5.6.16-1.fc23 updates
あった!!!!もしかして、これ入れればいけるんじゃ・・・?
// php-intlをインストール $ sudo yum install php-intl //phpコマンドで確認 $ php -i | grep intl /etc/php.d/20-intl.ini, intl intl.default_locale => no value => no value intl.error_level => 0 => 0 intl.use_exceptions => 0 => 0
いけた!!!
最後に、/etc/php.ini
にextension=intl.so
を追加。
もう一度インストール!
一度インストールしたディレクトリをすべて削除して、もう一度composerでcakePHPをインストール。
$ composer create-project --prefer-dist cakephp/app test Writing lock file Generating autoload files Set Folder Permissions ? (Default to Y) [Y,n]? Y
途中、ディレクトリのパーミッションを変更するか確認されるので、「Y」で応答。
1回目のブラウザ確認
ブラウザから、http://localhost
にアクセスして確認。
あれ、見れない。そもそもwebサーバが落ちてる。しかも上がらない。。。
しらべてみると、ダミーのindex.html
が必要とのこと。内容は空か、<html></html>
でいいみたい。
ドキュメントルートにindex.html
を追加。もう一度、apacheを起動。お、あがってきた。
2回目のブラウザ確認
再度、http://localhost
へアクセス。
それっぽい画面が出たけど、、、、パーミッションエラー。
このパターン最近見たぞ、と思ってSELINUXのコンテキストを変更。
chcon -R -t httpd_sys_rw_content_t .
(詳しくは前の記事を参照。)
最後のブラウザ確認
3度目の正直、http://localhost
へアクセス。
いけたー!ケーキのイラストが表示された!
webアプリはセキュリティとかパーミッションでいっつもやられるなー。
というわけで、今日からcakePHPで遊んでみます。