编译安装 PHP 7.1.7
http://www.cnblogs.com/huliujun/p/7131184.html
安装 MariaDB
yum install mariadb-server mariadb-client
https://mariadb.com/kb/zh-cn/configuring-mariadb-for-remote-client-access/
GRANT ALL PRIVILEGES ON *.* TO 'mos'@'localhost' IDENTIFIED BY 'password' WITH GRANT OPTION;
注:这是 root 权限
连接可能发生的错误
(1) DB 连接
MysqLi 连接数据库,有两种方式,如果指定 127.0.0.1 使用 TCP/IP,如果使用 localhost,使用 socket 连接。
如果使用 localhost 作为服务器名,以 socket 方式连接时,要确认 PHP.ini 文件中的 MysqLi_default_socket 设置要与 /etc/my.conf 中的 socket 设置保持一致,否则会报错:
Warning: MysqLi::__construct(): (HY000/2002): No such file or directory in ...
注:MysqL 采用unix socket连接方式,比用tcp的方式更快,但只适用于MysqL和应用同在一台PC上。(参考以下来源于 MysqL 文档)
https://dev.MysqL.com/doc/refman/5.5/en/can-not-connect-to-server.html
A MysqL client on Unix can connect to the MysqLd server in two different ways: By using a Unix socket file to connect through a file in the file system (default /tmp/MysqL.sock),or by using TCP/IP,which connects through a port number. A Unix socket file connection is faster than TCP/IP,but can be used only when connecting to a server on the same computer. A Unix socket file is used if you do not specify a host name or if you specify the special host name localhost.
(2) Session 目录
Warning: session_start() [function.session-start]: open(/tmp/sess_...
编译安装后,PHP 默认的 Session 保存目录是根目录 /,需要修改 /etc/PHP.ini 文件,设置session.save_path,指向到 PHP-fpm 运行用户 Nginx 有修改权限的位置。
原文链接:https://www.f2er.com/centos/376795.html