satococoa's blog

主にサーバーサイド、Web 系エンジニアのブログです。Go, Ruby, React, GCP, ...etc.

XAMPPを中心に手抜きでPHP環境を作った

CakePHPで作ったアプリのメンテナンスのため、なるべくGUIのリッチなソフトを使って、手抜きで環境を作ってみました。

(がっつり開発するならVirtualBox上に本番環境と同じようにLinuxたてる方がいいと思います。ただ今回はCakePHPなので適当でも動くため、手抜きです。)

インストールしたソフト一覧
あとはエディタは普通に手元のTextMateやらMacVimやらです。
普通にApacheでNameVirtual作って、Hosterでアクセスできるようにし、開発します。

MySQLの操作やら設定やらをターミナルで一通りやれることも必要ですが、ある程度覚えたらこんな風にきれいなツールを使って楽しくやることも大事だと思います。モチベーション重要。

いつも忘れて文字化けでひっかかるMySQL, PHPの設定を書いて今回は終わりです。
/etc/mysql/my.cnf
[mysqld] # このセクションに足す。
default-character-set = utf8
skip-character-set-client-handshake
MySQLのユーザを作る。
$ mysql -u root -p
> create user '[username]' identified by '[password]';
> grant all on *.* to '[username]';
sudo vim /etc/php5/apache2/php.ini
error_reporting, magic_quotes_gpc, upload_max_filesize, allow_url_fopenとかも一通り見る。
[mbstring]
; language for internal character representation.
mbstring.language = Japanese

; internal/script encoding.
; Some encoding cannot work as internal encoding.
; (e.g. SJIS, BIG5, ISO-2022-*)
mbstring.internal_encoding = UTF-8

; http input encoding.
;mbstring.http_input = auto

; http output encoding. mb_output_handler must be
; registered as output buffer to function
;mbstring.http_output = SJIS

; enable automatic encoding translation according to
; mbstring.internal_encoding setting. Input chars are
; converted to internal encoding by setting this to On.
; Note: Do _not_ use automatic encoding translation for
;       portable libs/applications.
mbstring.encoding_translation = Off

; automatic encoding detection order.
; auto means
;mbstring.detect_order = auto


; substitute_character used when character cannot be converted
; one from another
mbstring.substitute_character = none;

; overload(replace) single byte functions by mbstring functions.
; mail(), ereg(), etc are overloaded by mb_send_mail(), mb_ereg(),
; etc. Possible values are 0,1,2,4 or combination of them.
; For example, 7 for overload everything.
; 0: No overload
; 1: Overload mail() function
; 2: Overload str*() functions
; 4: Overload ereg*() functions
mbstring.func_overload = 0