#環境
・Apache
・Mac OS Sierra
・Macports
#やりたいこと
・CakePHPを開発環境で利用できるようにしたい
#できていないこと
・CakePHPのトップページを表示すること
#その他の情報
localhost/samplesite/
にアクセスすると以下のエラー文が表示されます。
Fatal error: You must enable the intl extension to use CakePHP. in /Users/name/Sites/samplesite/config/bootstrap.php on line 27
bootstrap.php on line 27
if (!extension_loaded('intl')) { trigger_error('You must enable the intl extension to use CakePHP.', E_USER_ERROR); }
phpinfoのphp.iniがnoneになっているのが原因なのかと思い
httpd.confに
<IfModule php7_module> PHPINIDir "/opt/local/etc/php70/php.ini" </IfModule>
を追加したのですが、phpinfoを見ても反映されませんでした。
何が原因なのかわからず、手がつけられない状態です。
気になる質問をクリップする
クリップした質問は、後からいつでもMYページで確認できます。
またクリップした質問に回答があった際、通知やメールを受け取ることができます。
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
回答2件
0
ベストアンサー
bash
1sudo port install php7-intl
バージョンは環境に合わせてください。
パッケージ名は以下で調べてみれば判明するはず。
bash
1sudo port search intl
以下のコマンドで起動したのであれば、
bash
1# apachectl restart
以下のコマンドで、ヘルプが表示される。
apachectl に限らず、たいていのコマンドには、ヘルプを表示するオプションが必ず存在しています。正直ググるより早い。
bash
1apachectl -?
コマンドによっては -? だったり --help だったりと統一性がないのが、難だが、
bash
1man apachectl
のように、man のあとに、コマンド名をつければ表示される。
bash
1apachectl -? 2 3Usage: /usr/sbin/httpd [-D name] [-d directory] [-f file] 4 [-C "directive"] [-c "directive"] 5 [-k start|restart|graceful|graceful-stop|stop] 6 [-v] [-V] [-h] [-l] [-L] [-t] [-T] [-S] [-X] 7Options: 8 -D name : define a name for use in <IfDefine name> directives 9 -d directory : specify an alternate initial ServerRoot 10 -f file : specify an alternate ServerConfigFile 11 -C "directive" : process directive before reading config files 12 -c "directive" : process directive after reading config files 13 -e level : show startup errors of level (see LogLevel) 14 -E file : log startup errors to file 15 -v : show version number 16 -V : show compile settings 17 -h : list available command line options (this page) 18 -l : list compiled in modules 19 -L : list available configuration directives 20 -t -D DUMP_VHOSTS : show parsed vhost settings 21 -t -D DUMP_RUN_CFG : show parsed run settings 22 -S : a synonym for -t -D DUMP_VHOSTS -D DUMP_RUN_CFG 23 -t -D DUMP_MODULES : show all loaded modules 24 -M : a synonym for -t -D DUMP_MODULES 25 -t -D DUMP_INCLUDES: show all included configuration files 26 -t : run syntax check for config files 27 -T : start without DocumentRoot(s) check 28 -X : debug mode (only one worker, do not detach)
bash
1 -t -D DUMP_INCLUDES: show all included configuration files
に書いてあるように、「設定ファイルを全て表示する」というものが存在しているのだから、これを実行する。
bash
1apachectl -t -D DUMP_INCLUDES
↓(結果:これは私の環境での結果)
bash
1apachectl -t -D DUMP_INCLUDES 2Included configuration files: 3 (*) /private/etc/apache2/httpd.conf 4 (491) /private/etc/apache2/extra/httpd-mpm.conf 5 (497) /private/etc/apache2/extra/httpd-autoindex.conf 6 (537) /private/etc/apache2/other/php5.conf
php5 があるので、こちらはこちらはコメントアウトして php7 にしたい。
php7の設定ファイルが存在するかどうか確認。
bash
1ls -al /private/etc/apache2/other/ 2 3total 0 4drwxr-xr-x 3 root wheel 102 8 9 08:35 . 5drwxr-xr-x 11 root wheel 374 9 21 22:34 .. 6-r--r--r-- 1 root wheel 194 8 9 08:35 php5.conf
存在していない。
bash
1php -v 2 3PHP 7.1.0 (cli) (built: Dec 2 2016 11:32:42) ( NTS ) 4Copyright (c) 1997-2016 The PHP Group 5Zend Engine v3.1.0-dev, Copyright (c) 1998-2016 Zend Technologies 6 with Zend OPcache v7.1.0, Copyright (c) 1999-2016, by Zend Technologies 7 with Xdebug v2.5.0, Copyright (c) 2002-2016, by Derick Rethans
コマンドラインでは php7 が存在している。
http と php をつなぐ何かがあるはず…
bash
1brew search http 2 3darkhttpd httperf 4homebrew/apache/httpd22 httpie 5homebrew/apache/httpd24 ✔ httping 6homebrew/php/php53-http httpry 7homebrew/php/php54-http httpstat 8homebrew/php/php54-httpparser httptunnel 9homebrew/php/php55-http libhttpserver 10homebrew/php/php55-httpparser libmicrohttpd 11homebrew/php/php56-http lighttpd 12homebrew/php/php56-httpparser mighttpd2 13http-parser nghttp2 14http_load slowhttptest 15httpdiff weighttp 16homebrew/emacs/know-your-http-well 17homebrew/emacs/simple-httpd 18homebrew/nginx/http-accounting-nginx-module 19homebrew/nginx/http-flood-detector-nginx-module 20homebrew/nginx/http-remote-passwd-nginx-module 21Caskroom/cask/httpscoop
homebrew/php/php56-http
があるのに、php7 がない!
そして初めてググる
homebrewでapache2.4とphp7.0.7をインストール
ちなみにphpインストールコマンドに--homebrew-apxsを付与すると、、
LoadModule php7_module /usr/local/opt/php70/libexec/apache2/libphp7.so
この一文がhttpd.conf(apache設定ファイル)に自動的に追記され、apache側がこのphpを(もしpcの中に色んなphpが混在していても)判別し、ブラウザで実行することができるようになる。これがないとこのphpはブラウザで(というかapacheで)認識できない。
投稿2016/12/13 05:19
編集2016/12/14 04:23退会済みユーザー
総合スコア0
0
エラーの内容は、phpのintl拡張が入っていないというものなので、php-intlパッケージをインストールすれば次に進めると思いますよ。
投稿2016/12/13 05:20
総合スコア6586
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2016/12/13 05:30
2016/12/13 05:33
あなたの回答
tips
太字
斜体
打ち消し線
見出し
引用テキストの挿入
コードの挿入
リンクの挿入
リストの挿入
番号リストの挿入
表の挿入
水平線の挿入
プレビュー
質問の解決につながる回答をしましょう。 サンプルコードなど、より具体的な説明があると質問者の理解の助けになります。 また、読む側のことを考えた、分かりやすい文章を心がけましょう。
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2016/12/13 05:29 編集
退会済みユーザー
2016/12/13 05:32
2016/12/13 05:34
退会済みユーザー
2016/12/13 05:36
2016/12/13 05:39 編集
退会済みユーザー
2016/12/13 05:41
2016/12/13 06:00
退会済みユーザー
2016/12/13 06:01
2016/12/13 06:02
2016/12/13 06:21
退会済みユーザー
2016/12/13 06:24
2016/12/13 06:27
退会済みユーザー
2016/12/13 06:34 編集
2016/12/13 06:34
退会済みユーザー
2016/12/13 06:35
2016/12/13 06:37 編集
退会済みユーザー
2016/12/13 06:40 編集
2016/12/13 06:41
退会済みユーザー
2016/12/13 06:44 編集
2016/12/13 06:50
退会済みユーザー
2016/12/13 06:54 編集
2016/12/13 12:41
2016/12/13 12:42
退会済みユーザー
2016/12/13 13:20 編集
2016/12/14 02:37
退会済みユーザー
2016/12/14 02:41
2016/12/14 02:48
退会済みユーザー
2016/12/14 03:09 編集
2016/12/14 04:32
退会済みユーザー
2016/12/14 04:53 編集
2016/12/14 05:05
退会済みユーザー
2016/12/14 11:51