Prestashop 1.7.6.5 安装指南

最近有朋友问 Prestashop . 安装遇到各种问题。起初希望程序员自己琢磨比较好。给“鱼”是错误的,要给“渔”(钓鱼的方法)。但因为朋友的各种问题实在太多,所以制作本安装指南。也希望大家可以评论有用的知识。

前言:

一般程序员的常规方式是去( https://github.com/PrestaShop/PrestaShop/tree/1.7.6.5 ) GIT CLONE GITHUB_URL 

git clone https://github.com/PrestaShop/PrestaShop.git

 依赖:下载完成后:

composer install;

 安装:cd install 后;执行命令安装:

php index_cli.php –domain=domain_name.com --db_server=mysql --db_name=prestashop --db_user=root --db_password=password --email=login@domain.com –password=12345678;

 完成安装截图:

 

 

 

问题:

  1. 环境问题;
  2. 扩展问题;
  3. 安装失败的问题;

环境问题. 提出问题没有什么意义,直接上解决方案:Docker 解决方案:

docker-compose.yml: compose docker 结构描述文件

###############################################################################
#                          Generated on phpdocker.io                          #
###############################################################################
version: "3.1"
services:

    memcached:
      image: memcached:alpine
      container_name: prestashop-17-first-memcached

    mailhog:
      image: mailhog/mailhog:latest
      container_name: prestashop-17-first-mailhog
      ports:
        - "7778:8025"

    redis:
      image: redis:alpine
      container_name: prestashop-17-first-redis

    mysql:
      image: mysql:5.7
      container_name: prestashop-17-first-mysql
      working_dir: /application
      volumes:
        - .:/application
      environment:
        - MYSQL_ROOT_PASSWORD=root
        - MYSQL_DATABASE=root
        - MYSQL_USER=root
        - MYSQL_PASSWORD=root
      ports:
        - "7779:3306"

    mariadb:
      image: mariadb:10.4
      container_name: prestashop-17-first-mariadb
      working_dir: /application
      volumes:
        - .:/application
      environment:
        - MYSQL_ROOT_PASSWORD=root
        - MYSQL_DATABASE=root
        - MYSQL_USER=root
        - MYSQL_PASSWORD=root
      ports:
        - "7780:3306"

    postgres:
      image: postgres:11.1-alpine
      container_name: prestashop-17-first-postgres
      working_dir: /application
      volumes:
        - .:/application
      environment:
        - POSTGRES_USER=root
        - POSTGRES_PASSWORD=root
        - POSTGRES_DB=root
      ports:
        - "7781:5432"

    elasticsearch:
      image: elasticsearch:6.5.4
      container_name: prestashop-17-first-elasticsearch

    webserver:
      image: nginx:alpine
      container_name: prestashop-17-first-webserver
      working_dir: /application
      volumes:
          - .:/application
          - ./phpdocker/nginx/nginx.conf:/etc/nginx/conf.d/default.conf
      ports:
       - "7777:80"

    php-fpm:
      build: phpdocker/php-fpm
      container_name: prestashop-17-first-php-fpm
      working_dir: /application
      volumes:
        - .:/application
        - ./phpdocker/php-fpm/php-ini-overrides.ini:/etc/php/7.1/fpm/conf.d/99-overrides.ini

phpdocker/php-fpm/Dockerfile :配置基本环境GIT \ PHP扩展 等

FROM phpdockerio/php71-fpm:latest
WORKDIR "/application"

# Fix debconf warnings upon build
ARG DEBIAN_FRONTEND=noninteractive

# Install selected extensions and other stuff
RUN apt-get update \
    && apt-get -y --no-install-recommends install  php-memcached php7.1-mysql php7.1-pgsql php-redis php7.1-sqlite3 php7.1-xmlrpc php7.1-xsl php-yaml php7.1-gd php7.1-intl \
    && apt-get clean; rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* /usr/share/doc/*

# Install git
RUN apt-get update \
    && apt-get -y install git \
    && apt-get clean; rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* /usr/share/doc/*

phpdocker/nginx/nginx.conf : 配置nginx

server {
    listen 80 default;

    client_max_body_size 108M;

    access_log /var/log/nginx/application.access.log;


    root /application/public;
    index index.php;

    if (!-e $request_filename) {
        rewrite ^.*$ /index.php last;
    }

    location ~ \.php$ {
        fastcgi_pass php-fpm:9000;
        fastcgi_index index.php;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        fastcgi_param PHP_VALUE "error_log=/var/log/nginx/application_php_errors.log";
        fastcgi_buffers 16 16k;
        fastcgi_buffer_size 32k;
        include fastcgi_params;
    }

    location /status {
        fastcgi_pass 127.0.0.1:9000;
        include fastcgi_params;
        fastcgi_param SCRIPT_FILENAME $fastcgi_script_name;
    }
    
}

 phpdocker/nginx/php-ini-overrides.ini : 重写 PHP 配置

upload_max_filesize = 100M
post_max_size = 108M

 以上实现 docker 的环境,创建完成文件后如下:

-/docker-compose.yml,

  |-/phpdocker/

    |-php-fpm/

      |-Dockerfile :

      |-php-ini-overrides.ini

    |-nginx/

      |-nginx.conf :

扩展问题:如上配置安装扩展:

php-memcached php7.1-mysql php7.1-pgsql php-redis php7.1-sqlite3 php7.1-xmlrpc php7.1-xsl php-yaml php7.1-gd php7.1-intl 

 

安装失败问题:

1,Link to database cannot be established: SQLSTATE[HY000] [2002] php_network_getaddresses: getaddrinfo failed: nodename nor servname provided, or not known

  • 配置出错,文件路径( install/classes/datas.php);

2,Link to database cannot be established: SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost' (using password: NO)

  • STEP 1,数据库配置错误;修改数据库用户,查看是否一定与ROOT用户有关。
  • STEP 2,如果还是上述错误提示。则是配置没有被读取;可直接修改 index_cli.php 配置数据文件; 如 1.7.6.5版本文件路径( install/classes/datas.php);.

3,加载12% 数据表创建问题、23% 语言加载失败 过程中失败;

  • 12% 数据表创建问题:检查数据库的配置与字符编码;
  • 23% 语言加载失败:检查是否连接网络;

4,安装依赖出错或太慢;

5,界面版安装 ?

6,开启debug ?

  • config/define.inc.php 修改 define('_PS_MODE_DEV_', true);

7,Link to database cannot be established: SQLSTATE[HY000] [2002] Connection refused

  • app/config/parameters.php 修改数据库配置;
    当使用 docker 时,database_host = container name ; port = 空 ;

8,504 Gateway Time-out 

  • 查看域名是否是 http://yourself.com/install/ ;
  • 删除 install 目录;

9,-

 

posted @ 2020-04-30 22:13  徐锅  阅读(1662)  评论(1编辑  收藏  举报