2016/12/07
DigitalOcean is awesome.
Here is how to build a MySQL server on DigitalOcean, using Ubuntu 16.04. It’s pretty easy, right?
$ sudo apt-get install mysql-server
$ sudo mysql_secure_installation
To allow network access, edit mysqld.cnf
file.
$ sudo vi /etc/mysql/mysql.conf.d/mysqld.cnf
Change this line
bind-address = 127.0.0.1
into
#bind-address = 127.0.0.1
https://www.digitalocean.com/community/tutorials/ufw-essentials-common-firewall-rules-and-commands
$ sudo ufw allow from xxx.xxx.xxx.xxx to any port 3306
Check the setting.
$ sudo ufw status
$ sudo service mysql restart
2016/03/09
みんな Carbon 使ってるー?私は毎日使ってます。
ところで、曜日を表示しようと思って、
echo Carbon::now()->format('Y年m月d日(D)');
とかやると、2016年03月09日(Wed)
ってなって、いやん、となったことありませんか?私はあります。
そんな時は、setlocale()
とformatLocalized()
メソッドを使うと、、
setlocale(LC_ALL, 'ja_JP.UTF-8');
echo Carbon::now()->formatLocalized('%Y年%m月%d日(%a)');
2016年03月09日(水)
ってなるんやで。
それぞれ、利用する変換指定子が異なるので注意。
format()
の時
http://php.net/manual/ja/function.date.php
formatLocalized()
の時
http://php.net/manual/ja/function.strftime.php
参考)Carbonについて2015年のPHPカンファレンス福岡で話した時のスライド
2016/01/26