CakePHP 3.X を入れてみた
CakePHPインストール
その前phpのバージョンCHECK ‘’‘ php -v ’‘’ macOS / Linuxの場合 Composerを使ってインストール Composerがない場合Composerインストールしてね。
# vim composer.json } "require": { "cakephp/cakephp": "3.4.*" } #composer update
エラーが起きました涙!!
Your requirements could not be resolved to an installable set of packages. Problem 1 - cakephp/cakephp 3.4.7 requires ext-intl * -> the requested PHP extension intl is missing from your system. - cakephp/cakephp 3.4.6 requires ext-intl * -> the requested PHP extension intl is missing from your system. - cakephp/cakephp 3.4.5 requires ext-intl * -> the requested PHP extension intl is missing from your system. - cakephp/cakephp 3.4.4 requires ext-intl * -> the requested PHP extension intl is missing from your system. - cakephp/cakephp 3.4.3 requires ext-intl * -> the requested PHP extension intl is missing from your system. - cakephp/cakephp 3.4.2 requires lib-icu >=4.8 -> the requested linked library icu has the wrong version installed or is missing from your system, make sure to have the extension providing it. - cakephp/cakephp 3.4.1 requires lib-icu >=4.8 -> the requested linked library icu has the wrong version installed or is missing from your system, make sure to have the extension providing it. - cakephp/cakephp 3.4.0 requires lib-icu >=4.8 -> the requested linked library icu has the wrong version installed or is missing from your system, make sure to have the extension providing it. - Installation request for cakephp/cakephp 3.4.* -> satisfiable by cakephp/cakephp[3.4.0, 3.4.1, 3.4.2, 3.4.3, 3.4.4, 3.4.5, 3.4.6, 3.4.7]. To enable extensions, verify that they are enabled in those .ini files: - /etc/php.ini - /etc/php.d/10-opcache.ini - /etc/php.d/20-bz2.ini - /etc/php.d/20-calendar.ini - /etc/php.d/20-ctype.ini - /etc/php.d/20-curl.ini - /etc/php.d/20-dom.ini - /etc/php.d/20-exif.ini - /etc/php.d/20-fileinfo.ini - /etc/php.d/20-ftp.ini - /etc/php.d/20-gd.ini - /etc/php.d/20-gettext.ini - /etc/php.d/20-iconv.ini - /etc/php.d/20-json.ini - /etc/php.d/20-mbstring.ini - /etc/php.d/20-mcrypt.ini - /etc/php.d/20-mysqlnd.ini - /etc/php.d/20-pdo.ini - /etc/php.d/20-phar.ini - /etc/php.d/20-posix.ini - /etc/php.d/20-shmop.ini - /etc/php.d/20-simplexml.ini - /etc/php.d/20-sockets.ini - /etc/php.d/20-sqlite3.ini - /etc/php.d/20-sysvmsg.ini - /etc/php.d/20-sysvsem.ini - /etc/php.d/20-sysvshm.ini - /etc/php.d/20-tokenizer.ini - /etc/php.d/20-xml.ini - /etc/php.d/20-xmlwriter.ini - /etc/php.d/20-xsl.ini - /etc/php.d/30-mysqli.ini - /etc/php.d/30-pdo_mysql.ini - /etc/php.d/30-pdo_sqlite.ini - /etc/php.d/30-wddx.ini - /etc/php.d/30-xmlreader.ini - /etc/php.d/40-igbinary.ini - /etc/php.d/50-redis.ini You can also run `php --ini` inside terminal to see which files are used by PHP in CLI mode.
cakephp3以後php-intlが必要になるっぽい。下記の記事「CakePHP3を泣きながらインストールした記録 - やったこと」を参考してphp-intlをインストールし、下記の一行を追加
# vim /etc/php.ini 追加 extensions=intl.so
もう一度 composer update
—————–別の方法(もっと簡単な方法)————————-
Cakephpプロジェクトを作成
$ php /usr/local/bin/composer self-update && composer create-project --prefer-dist cakephp/app your_app_name
http_load 使い方
http_load
webサーバ負荷テスト用ツールです。
自分メモのため、使い方を書いておきます。
1.インストール $ wget http://www.acme.com/software/http_load/http_load-09Mar2016.tar.gz $ tar xvfz http_load-09Mar2016.tar.gz $ cd http_load-09Mar2016 $ make $ make install ↓ここで問題が起きる rm -f /usr/local/bin/http_load cp http_load /usr/local/bin rm -f /usr/local/man/man1/http_load.1 cp http_load.1 /usr/local/man/man1 cp: cannot create regular file `/usr/local/man/man1': そのようなファイルやディレクトリはありません make: *** [install] エラー 1 →解決策 mkdir -p /usr/local/man/man1
これでhttpの負荷テストが出来るようになります! 例:
urlリストを作製して $ vim urls.txt http:hoge.com //5アクセス/秒、10秒アクセス http_load -rate 5 -seconds 10 urls.txt
httpsもテストしたい場合ちょっと複雑 Makefileファイルを改修する必要がある
$ cd http_load-09Mar2016 $ vim Makefile #SSL_TREE = /usr/local/ssl ← opensslのパスに変更[/usr/local/opt/openssl] #SSL_DEFS = -DUSE_SSL #SSL_INC = -I$(SSL_TREE)/include #SSL_LIBS = -L$(SSL_TREE)/lib -lssl -lcrypto //上記のコメントアウト部分を外す $ make ↓今回はまたトラブル 'openssl/ssl.h' file not found が出る ↓解決 僕はhomebrewを使ってopensslをインストール $ brew list $ brew link openssl --force これだけでは足りないので .bash_profileに以下のpathを追加する export PATH=/usr/local/opt/openssl/bin:$PATH export LD_LIBRARY_PATH=/usr/local/opt/openssl/lib:$LD_LIBRARY_PATH export CPATH=/usr/local/opt/openssl/include:$LD_LIBRARY_PATH $ make $ make install
多分問題なく通ると思う! さあ!httpsの負荷テストガンガンやりましょう!!
Basic認証 ぺージ遷移の度聞かれる
Chromeだけ、ぺージ遷移の度認証が効く
.htaccessにいかの内容を追加すればOK
<Files "favicon.ico"> AuthType none Satisfy any </Files>
参考リンク serverfault.com
git clone できない[fatal: Unable to find remote helper for 'https']
gitのインストール時に(lib)curl-devel ライブラリを読みこめていないことが問題
対応
- git 削除
$sudo yum remove git
- 必要パッケージのインストール
$ sudo yum install curl-devel expat-devel gettext-devel openssl-devel zlib-devel
- ソースのダウンロード
wget https://git-core.googlecode.com/files/git-1.8.5.3.tar.gz
- コンパイルしてインストール
$ tar -zxf git-1.8.5.3.tar.gz $ cd git-1.8.5.3 $ make prefix=/usr/local all $ sudo make prefix=/usr/local install
再度cloneにすれば治るはず
さくらインターネットVPS設定
htpasswd コマンドで設定
htpasswd -c /var/www/html/example/.htpasswd hoge
↓
New password:
Re-type new password:
.htpasswdファイルを作成
cd /var/www/html/example
AuthType Basic
AuthName "ユーザー名とパスワードを入力して下さい"
AuthUserFile /var/www/html/example/.htpasswd
Require valid-user
apacheを再起動
service httpd restart
※さくらサーバーの場合
.htaccessを有効する必要がある
①/var/www/htmlディレクトリ配下にある.htaccess有効する
[root@ ~]# vi /etc/httpd/conf/httpd.conf
.htaccess有効にするにはAllowOverride None⇨AllowOverride Allに変更
②その他のディレクトリ配下にある.htaccessを有効する
[root@ ~]# vi /etc/httpd/conf/httpd.conf
<Directory "/.htaccessのディレクトリ">
AllowOverride All
Order allow,deny
Allow from all
最後:Apache起動忘れず
参考サイト
.htaccessを有効にする | さくらインターネットのVPS設定マニュアル