欢迎投稿

今日深度:

Centos 7.3 + PHP7.1.7 + Mariadb,centosphp7.1.7

Centos 7.3 + PHP7.1.7 + Mariadb,centosphp7.1.7


编译安装 PHP 7.1.7

http://www.cnblogs.com/huliujun/p/7131184.html


安装 MariaDB

yum install mariadb-server mariadb-client


添加 mysql 连接登录用户

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 有修改权限的位置。


www.htsjk.Com true http://www.htsjk.com/mariadb/30562.html NewsArticle Centos 7.3 + PHP7.1.7 + Mariadb,centosphp7.1.7 编译安装 PHP 7.1.7 http://www.cnblogs.com/huliujun/p/7131184.html 安装 MariaDB yum install mariadb-server mariadb-client 添加 mysql 连接登录用户 https://mariadb.com/kb/zh-cn/con...
相关文章
    暂无相关文章
评论暂时关闭