Category Archives: Linux

Amazon Linuxにuser data一発でnginx+HHVMをインストール

  Amazon Linux上に、nginx+HHVM環境をつくりたい。 ググると、以下のサイトがヒットし、一目くじけそうになる。 Building and installing HHVM on Amazon Linux 2014.03 シンドい・・。   しかし、もう少しググると、思ったより簡単にできそう。 Amazon Linux これなら、EC2のインスタンス起動時にUser dataにシェルを渡せば、一発でインストールできそう。   Management Consoleにて、「Amazon Linux AMI 2014.09.2 (HVM) – ami-18869819」を利用し、t2.microのインスタンスを起動する。 途中、「Step 3: Configure Instance Details」画面のAdvanced Detailsで、以下のUser dataをAs textとしてコピペする #!/bin/bash -ex cd /etc/yum.repos.d wget http://www.hop5.in/yum/el6/hop5.repo echo ‘priority=9’ >> hop5.repo echo ‘includepkgs=glog,tbb’ >> hop5.repo wget http://yum.sexydev.com/sexydev-amazon.repo yum -y install nginx php php-mbstring hhvm cd /var/www/html touch index.php echo ‘<?php phpinfo(); ?>’ >> index.php インスタンス起動後、hhvmがインストールできていることを確認。 [ec2-user@ip-192-168-XXX-XXX ~]$ hhvm –version HipHop VM 3.3.6-dev (rel) Compiler: 1426768334_998390448 Repo schema: 999173952_1426768334 Extension API: 20140829 若干コンフィグを修正。 cd /etc/nginx sudo vi nginx.conf 修正点は3箇所。 index定義にindex.phpを追記。 index index.php index.html index.htm; serverセクション内のrootパスを変更。 root /var/www/html; FastCGIのlocation設定をアンコメントした上で、rootとfastcgi_paramの記述を変更。 # pass the PHP scripts to FastCGI server […]

Windows環境のMySQLで、character_set_clientの値をutf8に変更できない

  MySQLのバージョンは5.6.20。 Windowsの環境なのでmy.iniの[client]セクションに default-character-set = utf8 を追記したのだが、character_set_clientやcharacter_set_connectionの値がutf8にならず、cp932のままになる。 mysql> show variables like ‘char%’; +————————–+————————————————–+ | Variable_name | Value | +————————–+————————————————–+ | character_set_client | cp932 | | character_set_connection | cp932 | | character_set_database | utf8 | | character_set_filesystem | binary | | character_set_results | cp932 | | character_set_server | utf8 | | character_set_system | utf8 | | character_sets_dir | C:\PHP\pleiades\xampp\mysql\share\charsets\ | +————————–+————————————————–+ 8 rows in set (0.00 sec)   しばし黙考し、[mysqld]セクションの## UTF 8 Settingsで、”skip-character-set-client-handshake”のコメントアウトを解除していないことに気付いた。 コメントアウト解除、サーバ再起動後。 mysql> show variables like ‘char%’; +————————–+————————————————–+ | Variable_name | Value | +————————–+————————————————–+ | character_set_client | utf8 | | character_set_connection | utf8 | | character_set_database | utf8 | | character_set_filesystem | binary | | character_set_results | utf8 | | […]

Also posted in MySQL | Comments closed

[ERROR] mysql\bin\mysqld.exe: unknown variable ‘default-character-set=utf8’

  ん??? Windows 7上でXAMPPの環境作ってMySQL起動しようとしたのだが、エラーで起動しない。 mysql_error.logを見ると、 [ERROR] mysql\bin\mysqld.exe: unknown variable ‘default-character-set=utf8’ とある。 [mysqld]セクションに”default-character-set = utf8″を追記していたのだが、これがまずかった模様。 MySQL 5.5からは、サーバ側の文字コード指定の標記が変更になったらしい。 You can change the default server character set and collation with the –character-set-server and –collation-server options when you start the server. https://dev.mysql.com/doc/refman/5.5/en/charset-configuration.html というわけで、my.ini中の[mysqld]セクションの最後の方で character-set-server=utf8 としたらサーバ起動できた。

Also posted in MySQL | Comments closed