amazon-linux-extras

amazon-linux-extrasの場合は普通にphpを入れると5.4になる。

 

sudo amazon-linux-extras install epel
epel-release-7-11.noarch.rpm

sudo yum install https://rpms.remirepo.net/enterprise/remi-release-7.rpm
インストール:
remi-release.noarch 0:7.5-2.el7.remi

https://qiita.com/owlbeck/items/20f3e5402cb782f6291e
sudo amazon-linux-extras install php7.2

 

sudo yum install php-mysqlnd php-mbstring php-mcrypt php-pdo php-fpm php-mbstring php-xml

php-xmlがないとcomposerが動かない

react 入門


yarn init
yarn add webpack webpack-dev-server babel-core babel-loader babel-preset-react babel-preset-es2015

start コマンド
node_modules/.bin/webpack-dev-server

コンパイルコマンド
node_modules/.bin/webpack


静的解析
yarn add eslint eslint-plugin-react
node_modules/.bin/eslint --init
npmで消えたフォルダをyarnで入れ直す
yarn install

実行
node_modules/.bin/eslint src/index.js

sass install
yarn add node-sass style-loader css-loader sass-loader import-glob-loader extract-text-webpack-plugin


yarn add react@15.6.1 react-dom@15.6.1
(version古いかも)

axiosはGETやPOSTなど、様々なHTTPリクエストを投げることができるメソッド
yarn add axios

PropTypesは非推奨だからこれを使う
yarn add prop-types
import PropTypes from 'prop-types';

ソート用パッケージ
yarn add lodash
import _ from 'lodash';

1.モックをComponentに分割する
2.必要な情報を洗い出す
3.各情報をどのComponentのstateに詰めるか、どういうpropsで渡すか決める
4.ダミーデータでのComponent作成
5.実際のデータを流し込む

Component用ファイルはもらったデータをもとにhtml生成するだけ
Repositoryはデータ生成

ルーティング設定
yarn add react-router-dom
クエリ
yarn add query-string

redux install
yarn add redux react-redux redux-devtools


storeをsubscribeするのがcontainer
viewのパーツがcomponents

react context
一番親のcomponentで定義した変数をグローバル変数のように使える

php7 memcached install

yum install gcc-c++ -y が必要と気付かず結構はまった

 

```
yum install -y memcached
yum install -y php71-php-pecl-memcached
```
`libmemcached install`
```
yum install gcc-c++ -y
cd /usr/local/src/
wget https://launchpad.net/libmemcached/1.0/1.0.18/+download/libmemcached-1.0.18.tar.gz
tar xzf libmemcached-1.0.18.tar.gz
cd libmemcached-1.0.18
./configure
make
make install
```

`php-memcached install`
```
cd /usr/local/src
git clone -b php7 --depth 1 https://github.com/php-memcached-dev/php-memcached
cd php-memcached
yum install php70-devel -y
phpize
yum install zlib-devel
./configure --disable-memcached-sasl
make
make install
```

`vim /etc/php.ini`
```
extension=memcached.so
```

chkconfig memcached on

 

参考
https://qiita.com/nnmr/items/656259946d852d8c90e2#_reference-5734b77adda74649612b

 

 

値 一覧表示

memcached-tool localhost dump

redis classをベタで書く

<?php

class RedisService {

private $redis;

/**
*
*/
public function __construct() {

$hostname = '127.0.0.1';
$port = 6379;

$this->redis = new Redis();

if (!$this->redis->connect($hostname, $port)) {
throw new Exception('fail connect redis server.');
}
}

/**
*
*/
public function __destruct() {
$this->redis->close();
}

public function setValue($key, $value) {
$this->redis->set($key, $value);
}

public function getValue($key) {
return $this->redis->get($key);
}
}



PHPからRedisを使うPhpredisライブラリ | プログラミング初心者の勉強方法

EC2新規作成 php version

 

基本はいつもどおり

CentOS7+nginx+php7+MariaDBの環境構築 - Qiita

これでいけるけど、

なぜかphp のversionが古い

 

yum remove php-* httpd-*

AWS EC2 Amazon Linux 2016.09 + nginx + PHP7.0でサーバー構築 - Qiita

sudo yum install php70
sudo yum install php70-mysqlnd php70-mbstring php70-mcrypt php70-pdo php70-xml php70-fpm

version明示する必要がある