update
cat /etc/redhat-release
yum update
history
shopt
vi /etc/profile.d/history.sh

HISTTIMEFORMAT='%F %T '
HISTSIZE=100000
HISTFILESIZE=100000
HISTIGNORE='history:pwd:ls:ls *:ll:w:top:df *'      # 保存しないコマンド
PROMPT_COMMAND='history -a; history -c; history -r' # 履歴のリアルタイム反映
timezone
ll /etc/localtime
timedatectl
date

timedatectl set-timezone Asia/Tokyo
apache
systemctl status apache
systemctl status httpd

yum install epel-release
yum install https://repo.ius.io/ius-release-el7.rpm

vi /etc/yum.repos.d/epel.repo
vi /etc/yum.repos.d/ius.repo
enabled=0

yum install centos-logos.noarch mailcap openldap-devel expat-devel libdb-devel openssl perl
yum --enablerepo=epel install nghttp2 brotli
yum install --disablerepo=base,extras,updates --enablerepo=ius httpd httpd-devel mod_ssl
yum list | grep httpd
systemctl start httpd
systemctl enable httpd.service

httpd -h
httpd -S
httpd -t -D DUMP_VHOSTS
httpd -t -D DUMP_RUN_CFG
httpd -v
httpd -V
httpd -l
httpd -t -D DUMP_MODULES
httpd -M
httpd -t -D DUMP_INCLUDES

ll /var/log/httpd/
less /etc/logrotate.conf
less /etc/logrotate.d/httpd

mkdir /var/www/html/php
chmod 777 /var/www/html/php/
ps aux | grep httpd
systemctl reload httpd
systemctl status httpd
systemctl restart httpd
systemctl status httpd
php5.4
yum info php
rpm -q --changelog php | grep CVE | less

yum install php
php -v
php -r 'phpinfo();'  | less
php modules
php -m | less
yum list --enablerepo=epel | grep php | less
yum install php-bcmath
php -m | less

vi bcmath.php
php bcmath.php
vi gettext.php
php gettext.php
vi gettext.php
php /var/www/html/php/phpinfo.php | less
yum list --enablerepo=epel | grep php | less
yum install php-pgsql
vi postgresql.php
php postgresql.php
mkdir php
vi *.php php/.
mv *.php php/.

php -m | less
yum install --enablerepo=epel php-pecl-redis
php -m | less
vi redis.php
php redis.php
php -m | less
postgresql13
yum install postgresql
yum install centos-release-scl
yum repolist -q
yum repolist all | less
vi /etc/yum.repos.d/CentOS-SCLo-scl.repo
vi /etc/yum.repos.d/CentOS-SCLo-scl-rh.repo
↓
enabled=0

yum repolist all | less
yum repolist -q
yum install https://download.postgresql.org/pub/repos/yum/reporpms/EL-7-x86_64/pgdg-redhat-repo-latest.noarch.rpm
yum install postgresql13-contrib
yum install postgresql13-devel

yum repolist -q
yum install --enablerepo=epel postgresql13-devel
systemctl enable postgresql-13.service
ll /var/lib/pgsql/13/data/
PGSETUP_INITDB_OPTIONS="-E UTF8 --no-locale" /usr/pgsql-13/bin/postgresql-13-setup initdb
ll /var/lib/pgsql/13/data/
su - postgres

vi /var/lib/pgsql/.pgsql_profile
↓
PATH=/usr/pgsql-13/bin:$PATH
export PATH

which psql
psql -v
psql --version
/usr/pgsql-13/bin/psql --version
ls /bin/psql
ll /bin/psql
ll /etc/alternatives/pgsql-psql
pg_ctl
source .bash_profile

psql -l
psql -U postgres
createuser --login --pwprompt centos
createdb --owner=centos centos
systemctl start postgresql-13
ps aux | grep master
psql -U postgres
psql -l
redis6.2
yum list | grep redis
yum list --enablerepo=epel | grep redis
rpm -ivh http://rpms.famillecollet.com/enterprise/remi-release-7.rpm
vi /etc/yum.repos.d/remi.repo
vi /etc/yum.repos.d/remi-safe.repo
↓
enabled=0

yum info --enablerepo=epel,remi redis
yum install --enablerepo=epel,remi redis
less /usr/lib/systemd/system/redis.service
systemctl status redis
systemctl enable redis
systemctl status redis
ps aux | grep redis
systemctl start redis
ps aux | grep redis
redis-cli ping
systemctl status redis

less /etc/logrotate.d/redis
pure-ftpd1.0.43
yum list | grep pure | less
yum list --enablerepo=epel | grep pure | less
cat /etc/redhat-release
yum update centos-release
→アップデート無し

yum repolist all | less
yum info --enablerepo=C7.0.1406-base pure-ftpd
yum search --enablerepo=C7.0.1406-base ftp
yum search ftp | less
yum install pure-ftpd
yum repolist all | less
yum list --enablerepo=epel | grep pure

cd /usr/local/src/
yum install wget
wget https://download.pureftpd.org/pub/pure-ftpd/releases/obsolete/pure-ftpd-1.0.43.tar.gz
tar xvzf pure-ftpd-1.0.43.tar.gz
cd pure-ftpd-1.0.43
yum install gcc
yum install openssl-devel
./configure --with-everything --with-paranoidmsg --without-capabilities --with-virtualchroot --with-uploadscript --with-tls
make
make install

https://gist.githubusercontent.com/zrong/c9588a17ccb15e75fdf7/raw/a24c563bfe0cdc238952ce24f560a8de42631c0f/pure-ftpd.sh

systemctl status pure-ftpd
cp configuration-file/pure-ftpd.conf /etc/.
cp configuration-file/pure-config.py /usr/local/bin/.
vi /etc/init.d/pure-ftpd
chmod 755 /etc/init.d/pure-ftpd
chmod 755 /usr/local/bin/pure-config.py
/etc/init.d/pure-ftpd start
ps aux | grep pure
yum install ftp
ftp localhost
java1.8.0
yum list | grep java | less
yum install java-1.8.0-openjdk
java -version
node.js14
yum list --enablerepo=epel | grep node | less
curl -fsSL https://rpm.nodesource.com/setup_14.x | bash -
vi /etc/yum.repos.d/nodesource-el7.repo
yum list | grep node
yum list | grep node | less
yum install nodejs
node -v
npm install forever -g
vi index.js
node index.js
forever start index.js
ll
vi node.js
mkdir node.js
mv index.js node.js/.

環境

$ uname -r
4.4.35-33.55.amzn1.x86_64

$ /usr/local/php-5.6.16/bin/php --version
PHP 5.6.16 (cli) (built: Aug 28 2017 06:35:52)
Copyright (c) 1997-2015 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2015 Zend Technologies

結論

curl のタイムアウト動作に対して、
  • default_socket_timeout は影響確認できず(ini_set)
  • max_execution_time は影響確認できず(set_time_limit)
  • CURLOPT_CONNECTTIMEOUT は作用する(curl_setopt)
  • CURLOPT_TIMEOUT も作用する (curl_setopt)
  • CURLOPT_DNS_CACHE_TIMEOUT は影響確認できず(curl_setopt)
  • デフォルトでは2分強でタイムアウト(カーネル仕様と思われる)

curl_setopt 設定値

CURLOPT_CONNECTTIMEOUT :接続の試行を待ち続ける秒数。0 は永遠に待ち続けることを意味します。
CURLOPT_TIMEOUT:cURL 関数の実行にかけられる時間の最大値。

curl_errno の戻り値

  • 正常時:CURLE_OK (0)
  • カーネル側のタイムアウト:CURLE_COULDNT_CONNECT (7)
  • CURLOPT_CONNECTTIMEOUT / CURLOPT_TIMEOUT:CURLE_OPERATION_TIMEDOUT (28)

カーネル側のタイムアウト動作

$ time /usr/local/php-5.6.16/bin/php curl.php
real    2m7.345s
user    0m0.000s
sys     0m0.012s

$ cat /proc/sys/net/ipv4/tcp_syn_retries
6

参考リンク

curl の戻り値
https://curl.haxx.se/libcurl/c/libcurl-errors.html curl実行中に応答が無くなる現象
https://ngyuki.hatenablog.com/entry/2019/09/21/191552 curlのデフォルト値等

https://www.it-swarm.dev/ja/php/php%EF%BC%9A%E3%83%87%E3%83%95%E3%82%A9%E3%83%AB%E3%83%88%E3%81%AEcurl%E3%82%BF%E3%82%A4%E3%83%A0%E3%82%A2%E3%82%A6%E3%83%88%E5%80%A4/1067580731/

https://www.it-swarm.dev/ja/php/php%E3%81%A7%E3%81%AEcurl%E3%81%AE%E3%82%BF%E3%82%A4%E3%83%A0%E3%82%A2%E3%82%A6%E3%83%88%E3%81%AE%E8%A8%AD%E5%AE%9A/968216261/

https://stackoverflow.com/questions/10308915/php-default-curl-timeout-value TCPタイムアウト
https://qiita.com/tukiyo3/items/e66393cf5fd0ede8b3b4

ソースコード

<?php

// default_socket_timeout は、本コードでのタイムアウト動作には影響しない
$socket_timeout = ini_get('default_socket_timeout');
print_r("socket_timeout: $socket_timeout \n"); // -> 60

ini_set('default_socket_timeout', 10);

// max_execution_time は、本コードでのタイムアウト動作には影響しない
$max_execution_time = ini_get('max_execution_time'); // timeout in seconds
print_r("max_execution_time: $max_execution_time \n"); // -> 0

set_time_limit(5);

$max_execution_time = ini_get('max_execution_time');
print_r("max_execution_time: $max_execution_time \n"); // -> 5

$url = "https://www.google.com"; // 正常実行
//$url = "8.8.8.8"; // for connect timeout test
//$url = "http://httpbin.org/delay/10"; // for timeout test

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);

// デフォルト5分のようだが、カーネルプロトコルスタックのTCP制御で2分強でタイムアウトする
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 3);
//curl_setopt($ch, CURLOPT_CONNECTTIMEOUT_MS, 3500);

// デフォルトは、無期限
curl_setopt($ch, CURLOPT_TIMEOUT, 5);
//curl_setopt($ch, CURLOPT_TIMEOUT_MS, 10000);

curl_setopt($ch, CURLOPT_DNS_CACHE_TIMEOUT, 3); // 本コードでのタイムアウト動作には影響しない

$str = curl_exec($ch);
$errno = curl_errno($ch);

curl_close($ch);

if ($errno !== CURLE_OK) {
    print_r("errno: $errno \n");
    // CURLE_COULDNT_CONNECT (7) -> カーネル側のタイムアウト
    // CURLE_OPERATION_TIMEDOUT (28) -> CURLOPT_CONNECTTIMEOUT or CURLOPT_TIMEOUT
    return false;
}

if (!$str) {
    print_r("error");
    return false;
}

print_r("success");
return true;

https://github.com/fuel/core/wiki/Changelog-v1.6

見つからず。

http://fuelphp.jp/docs/1.6/requirements.html

5.3.2

 

https://github.com/fuel/core/wiki/Changelog-v1.7

http://fuelphp.jp/docs/1.7/requirements.html

5.5+とある。

 

https://github.com/fuel/core/wiki/Changelog-v1.8

PHP 7 とある。

また、一部5.6+と。

 

https://github.com/fuel/core/wiki/Changelog-v1.8.1

PHP7.1とある。

 

git log –graph –oneline –decorate=full –date=short –format=”%C(yellow)%h%C(reset) %C(magenta)[%ad]%C(reset)%C(auto)%d%C(reset) %s %C(cyan)@%an%C(reset)” remotes/origin/1.8/master

  • c7e7a4a [2018-04-27] (tag: refs/tags/1.8.1.3) hash_equals is php 5.6+, add compatibility layer @WanWizard

ここで、5.6対応も入っていたりする。

その前は、1.7時台。

  • 8e774d4 [2015-11-13] split off php 5.6+ code to avoid syntax errors in older versions; closes #1952 @WanWizard

 

https://github.com/fuel/core/commits/1.9/develop

7.2, 7.3が。

 

PHP5.6 Fuelphp1.8

 

となったので、

 

と作成

とできた。

yum install gettext は不要だった

<?php

error_reporting(E_ALL ^ E_NOTICE ^ E_DEPRECATED);

$language = ‘en’;
if (ereg(‘ja’, $_SERVER[‘HTTP_ACCEPT_LANGUAGE’])) {
$language = ‘ja_JP.UTF-8’;
}
// Set locale and default domain.
putenv(“LANG=$language”);
setlocale(LC_ALL, $language);
$domain = ‘messages’;
bindtextdomain($domain, “/var/www/html/sandbox/lang/locale”);
textdomain($domain);

// Output
echo gettext(“Hello”);

echo gettext(“World”);

 

1019 xgettext -n hello.php
1024 less messages.po
1026 mkdir locale
1027 mkdir locale/en
1028 mkdir locale/ja_JP
1029 mkdir locale/en/LC_MESSAGES
1030 mkdir locale/ja_JP/LC_MESSAGES
1031 cp messages.po locale/en/LC_MESSAGES/.
1032 mv messages.po locale/ja_JP/LC_MESSAGES/.
1033 cd locale/en/LC_MESSAGES/.
1034 msgfmt messages.po
1036 cd ../
1037 cd ../ja_JP/LC_MESSAGES/
1038 msgfmt messages.po

# pear upgrade pear

WARNING: “pear/Console_Getopt” is deprecated in favor of “pear/Console_GetoptPlus”
downloading PEAR-1.10.1.tgz …
Starting to download PEAR-1.10.1.tgz (296,139 bytes)
…………………………………………………….done: 296,139 bytes
could not extract the package.xml file from “/tmp/pear/download/PEAR-1.10.1.tgz”
Download of “pear/pear” succeeded, but it is not a valid package archive
Error: cannot download “pear/PEAR”

・・・

 

PHPを更新していたので、以下のように。

# cp /usr/local/php-5.6.12/lib/php/Archive/Tar.php /usr/share/pear/Archive/Tar.php

参考:

http://phpobenkyo.seesaa.net/article/410455059.html

http://www.gentei.org/~yuuji/rec/pc/memo/2014/08/30/