相关内容:
https://blog.csdn.net/freewebsys/category_12461196.html
原文地址:
https://blog.csdn.net/freewebsys/article/details/133666433
包括以下运行的详细代码:
https://gitee.com/study-demo-all/oscommerce2-study
视频教程:
https://www.bilibili.com/video/BV1kB4y1Z7HS/?vd_source=4b290247452adda4e56d84b659b0c8a2
首先是镜像的选择,统一使用debian的基础镜像,库安装方便。同时镜像也比较小。
常用的命令也非常熟悉。
相关的debian版本:
Debian 11 “Bullseye” To be defined: roughly July 2024 to June 2026
build: ./dir 是个文件夹
里面需要有个文件叫 Dockerfile, 才可以。
对于php-fpm来说是:
############### 使用 php:7-fpm 版本 ###############
php-fpm:
restart: always
build: ./php-fpm-bullseye-mysql
image: php-fpm-bullseye-mysql
container_name: php-fpm
其中需要使用 php7会有一些警告。配置下就可以。
但是php8 不能运行了一个函数报错了:
Fatal error: Uncaught Error: Call to undefined function get_magic_quotes_gpc() in /var/www/html/includes/functions/compatibility.php:46 Stack trace: #0 /var/www/html/includes/application_top.php(41): require() #1 /var/www/html/index.php(13): require('/var/www/html/i...') #2 {main} thrown in /var/www/html/includes/functions/compatibility.php on line 46
可以安装成功,但是不能运行。
The PHP function get_magic_quotes_gpc() was deprecated in PHP 7.4 and removed in PHP 8.
也就是最高的版本就是 php7 才可以运行osc项目。
# 只能使用最新的 PHP7 版本
FROM php:7-fpm-bullseye
RUN sed -i "s/deb.debian.org/mirrors.aliyun.com/g" /etc/apt/sources.list && apt update && \
apt -y install wget libwebp-dev libjpeg-dev libpng-dev libfreetype6-dev libc-client-dev libkrb5-dev libzip-dev && \
docker-php-ext-configure gd --with-jpeg=/usr/include --with-freetype=/usr/include/ && \
docker-php-ext-install gd && docker-php-ext-enable gd && \
docker-php-ext-install mysqli && docker-php-ext-enable mysqli && apt clean
然后执行执行 docker-compose up -d 就可以同时构建镜像,然后再运行。
本地就会有个镜像:
$ docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
php-fpm-bullseye-mysql latest 8c83373ac361 9 hours ago 491MB
## 启动命令:
## docker-compose up -d -f docker-compose-mysql.yml
version: "3"
services:
################## mysql 数据库 5.7 版本 ##################
mysql-osc:
restart: always
image: mysql:5.7
container_name: mysql-osc
ports:
- "3306:3306"
volumes:
- "./data/mysql/data:/var/lib/mysql"
- "./mysql/mysql.cnf:/etc/mysql/conf.d/mysql.cnf"
#- "./mysql/init.sql:/docker-entrypoint-initdb.d/init.sql"
- "./mysql/connDB.sh:/connDB.sh"
environment:
MYSQL_ROOT_PASSWORD: mysqlosc
MYSQL_DATABASE: osc
TZ: Asia/Shanghai
command: [
'--character-set-server=utf8mb4',
'--collation-server=utf8mb4_general_ci',
'--max_connections=3000'
]
############### 使用 php:7-fpm 版本 ###############
php-fpm:
restart: always
build: ./php-fpm-bullseye-mysql
image: php-fpm-bullseye-mysql
container_name: php-fpm
ports:
- "9000:9000"
volumes:
- "./oscommerce2-2.3.4/catalog:/var/www/html"
- "./php/php-fpm.conf:/usr/local/etc/php-fpm.conf"
links:
- mysql-osc:mysql-osc
############### 使用 nginx 版本 ###############
nginx-osc:
restart: always
image: nginx:bullseye
container_name: nginx-osc
ports:
- "8080:8080"
volumes:
- "./oscommerce2-2.3.4/catalog:/var/www/html"
- "./data/nginx/logs:/data/logs"
- "./nginx/nginx.conf:/etc/nginx/conf.d/default.conf"
links:
- php-fpm:php-fpm
版本虽然古老但是也是支持汉化的。
也可以搜索到相关的汉化包:
汉化后的效果:
解压缩安装到admin目录下面:
然后就是增加配置,发现需要增加类目和产品描述,否则产品也不展示:
2 代表是中文数据,插入结算货币和语言:
INSERT INTO currencies VALUES (3,'Chinese RMB','CNY','¥','','.',',','2','1.0000', now());
INSERT INTO languages VALUES (2,'简体中文','cn','icon.gif','chinese',0);
INSERT INTO categories_description VALUES ( '1', '2', '硬件');
INSERT INTO categories_description VALUES ( '2', '2', '软件');
INSERT INTO categories_description VALUES ( '3', '2', 'DVD电影');
INSERT INTO categories_description VALUES ( '4', '2', '显卡');
INSERT INTO categories_description VALUES ( '5', '2', '打印机');
INSERT INTO categories_description VALUES ( '6', '2', '显示器');
INSERT INTO categories_description VALUES ( '7', '2', '扬声器');
INSERT INTO categories_description VALUES ( '8', '2', '键盘');
INSERT INTO categories_description VALUES ( '9', '2', '鼠标');
INSERT INTO categories_description VALUES ( '10', '2', '动作');
INSERT INTO categories_description VALUES ( '11', '2', '科幻');
INSERT INTO categories_description VALUES ( '12', '2', '喜剧');
INSERT INTO categories_description VALUES ( '13', '2', '卡通');
INSERT INTO categories_description VALUES ( '14', '2', '惊悚');
INSERT INTO categories_description VALUES ( '15', '2', '戏剧');
INSERT INTO categories_description VALUES ( '16', '2', '内存');
INSERT INTO categories_description VALUES ( '17', '2', 'CD-ROM 驱动器');
INSERT INTO categories_description VALUES ( '18', '2', '模拟');
INSERT INTO categories_description VALUES ( '19', '2', '动作');
INSERT INTO categories_description VALUES ( '20', '2', '策略');
INSERT INTO categories_description VALUES ( '21', '2', '配件');
INSERT INTO products_description VALUES (1,2,'Matrox G200 MMS','加强了其在多监视器领域的领先地位,Matrox Graphics Inc.再次开发出业界最灵活、最先进的解决方案。向您介绍新的 Matrox G200 多监视器系列;首款支持单个 8 英寸 PCI 主板上最多四个 DVI 数字平板显示器的显卡。随着金融工作场所对数字平板显示器的需求不断增长,Matrox G200 MMS 成为灵活解决方案的终极选择。Matrox G200 MMS 还支持数字显示工作组(DDWG)创建的新数字视频接口(DVI),旨在促进数字平板显示器的采用。其他配置包括复合视频捕获能力和内置电视调谐器,使 Matrox G200 MMS 成为满足商务需求的完整解决方案。基于获奖的 MGA-G200 图形芯片,Matrox G200多监视器系列提供卓越的2D/3D图形加速功能,满足诸如实时股票报价(Versus)、实时视频流(Reuters 和 Bloombergs)、多个窗口应用程序、文字处理、电子表格以及 CAD 等商务应用的需求。','www.matrox.com/mga/products/g200_mms/home.cfm',0);
INSERT INTO products_description VALUES (2,2,'Matrox G400 32MB','Dramatically Different High Performance Graphics
Introducing the Millennium G400 Series - a dramatically different, high performance graphics experience. Armed with the industry\'s fastest graphics chip, the Millennium G400 Series takes explosive acceleration two steps further by adding unprecedented image quality, along with the most versatile display options for all your 3D, 2D and DVD applications. As the most powerful and innovative tools in your PC\'s arsenal, the Millennium G400 Series will not only change the way you see graphics, but will revolutionize the way you use your computer.
Key features:- New Matrox G400 256-bit DualBus graphics chip
- Explosive 3D, 2D and DVD performance
- DualHead Display
- Superior DVD and TV output
- 3D Environment-Mapped Bump Mapping
- Vibrant Color Quality rendering
- UltraSharp DAC of up to 360 MHz
- 3D Rendering Array Processor
- Support for 16 or 32 MB of memory
','www.matrox.com/mga/products/mill_g400/home.htm',0);
....
也就是 categories_description products_description 类目和产品描述都需要输入英文信息才可以。
只是翻译了第一条数据,其他的数据没有翻译,直接拷贝的才可以。
效果是:
汉化的入口在语言上面: