Nginx Notes and Summary (one) Nginx + php-fpm + MySQL installation Ecshop

Source: Internet
Author: User
Tags chmod fpm set time

Download Ecshop (ecshop_v2.7.3_utf8_release1106) installation package, unzip the upload folder after the FTP to the server/usr/local/html directory, and renamed to Ecshop, in the browser to access the HTTP ://192.168.254.100/ecshop/install/index.php, if displayed: ECT () failed (111:connection refused) while connecting to upstream, If the PHP-FPM is not started, start php-fpm with the following command:

[Email protected] nginx]#/USR/LOCAL/FASTPHP/SBIN/PHP-FPM

Fastphp is the directory where PHP is installed.

If you need to access only http://192.168.254.100/ecshop/install, you need to modify nginx.conf:

[Email protected] nginx]# vim conf/nginx.conf

Add index.php to Location/{index}:

        Location/{            root   html;            Index index.php index.html index.htm;        }

Smooth restart Nginx.

Visit Http://192.168.254.100/ecshop/install at this time:

Next, modify the non-writable directory permissions:

"+" indicates increased permissions. "-" indicates the reduction of permissions.
The owner of the file can be represented by the letter U, where the user's group can be represented by the letter G, and the other person can be represented by the letter O, and all can be represented by the letter A.

Directory Permissions:

[[email protected] ecshop]# chmod o+w cert-r[[email protected] ecshop]# chmod o+w images-r[[email protected] ecshop]# CH MoD o+w data-r  [[email protected] ecshop]# chmod o+w temp-r

Template permissions:

[Email protected] ecshop]# chmod o+w themes-r

Refresh the page again at this point:

Next.

If the connection database fails (user name: root, Password: 123456):

The reasons are:

Under Linux, when connecting with localhost, it is not connected via the TCP protocol, but is connected via socket sockets, which can be seen in phpinfo, and no socket is specified:

Solution 1:

Change localhost to 127.0.0.1

Solution 2:

Find Mysql.sock

[[Email protected] ecshop]# PS ax|grep mysql 1262?        S      0:00/bin/sh/usr/local/mysql/bin/mysqld_safe--datadir=/usr/local/mysql/data--pid-file=/usr/local/mysql/ Data/mysql.pid 1573?        Sl     0:07/usr/local/mysql/bin/mysqld--basedir=/usr/local/mysql--datadir=/usr/local/mysql/data--plugin-dir=/ Usr/local/mysql/lib/plugin--user=mysql--log-error=/usr/local/mysql/data/error.log--pid-file=/usr/local/mysql/ Data/mysql.pid--socket=/data/mysql/mysql.sock--port=3306 3772 pts/0    s+     0:00 grep mysql

Or

[[email protected] ecshop]# Vim/etc/my.cnf[client] #password       = Your_passwordport            = 3306socket =          /data/ mysql/mysql.sock# here follows entries for some specific programs# the mysql server[mysqld]port            = 3306socket          =/da Ta/mysql/mysql.sock

Or

[Email protected] ecshop]# Find/-name Mysql.sock/data/mysql/mysql.sock

Mysql.sock's path in/data/mysql/mysql/sock

  

Specifies the socket.

[Email protected] ecshop]# Vim/usr/local/fastphp/lib/php.ini

php.ini:

Locate Mysql.default_socket, specified as:

Mysql.default_socket =/data/mysql/mysql.sock

Save exit.

Kill PHP-FPM Process:

[Email protected] ecshop]# pkill-9 PHP-FPM

Start PHP-FPM:

[Email protected] ecshop]#/USR/LOCAL/FASTPHP/SBIN/PHP-FPM

(However, this issue has not been resolved yet, using localhost cannot connect to the database and use PHP for detection:

<?var_dump (mysql_connect (' localhost ', ' root ', ' 123456 '));

Show:

Warning:mysql_connect () [Function.mysql-connect]: [2002] Permission denied (trying to connect via unix:///data/mysql/ Mysql.sock) in/usr/local/nginx/html/test.php on line 3warning:mysql_connect () [Function.mysql-connect]: Permission Denied in/usr/local/nginx/html/test.php on line 3bool (false)

  

Use 127.0.0.1 to connect to the database and continue.

Set the database name: Shop

Admin Name: admin

Login Password: admin123

e-mail: [Email protected]

Set time zone: P.R. China

Installing test data

  

Install Now.

Error:

Cause: The time zone configuration is incorrect.

Solution, configure php.ini:

Locate the Date.timezone, remove the comment, and set date.timezone = PRC:

Save exit.

Kill Process PHP-FPM and start php-fpm:

Install Now.

  

The installation was successful.

Reference:

"Linux chmod command"

Modify the location of the Mysql.sock, how to specify the modified Mysql.sock when the program is connected

Nginx Notes and Summary (one) Nginx + php-fpm + MySQL installation Ecshop

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.