osCommerce是自由软件社区最受欢迎的网络商店系统之一。 国外比较流行的系统。
使用PHP进行开发的。osCommerce算是比较老的项目了。 不妨碍进行学习,有说是GPL开源的。 但是看到项目代码说的是 MIT 开源的。
https://github.com/osCommerce/oscommerce2/releases 使用 2014年6月10日的版本进行学习,版本2.3.4。
https://github.com/osCommerce/oscommerce2/releases/tag/v2.3.4
新的代码也比较大了。
配置nginx的路径必须和php-fpm的文件路径一致才可以。 配置文件如下:
yaml## 启动命令:
## 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:5-fpm 版本 ###############
php-fpm:
restart: always
image: php:5-fpm
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:latest
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
遇到的错误:
bash2023/10/05 13:19:41 [error] 30#30: *4 FastCGI sent in stderr: "Primary script unknown" while reading response header from upstream, client: 172.27.0.1, server: localhost, request: "GET /info.php HTTP/1.1", upstream: "fastcgi://172.27.0.3:9000", host: "127.0.0.1:8080"
和页面中的 404 就是路径的配置问题
需要注意,这里必须使用 php5 的版本。
登陆容器执行:
docker exec -it php-fpm bash
bashsed -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
# install mysqli
docker-php-ext-install mysqli
docker-php-ext-enable mysqli
然后安装完成,再重启容器:docker restart php-fpm
再设置文件读权限:
bashchmod 777 /var/www/html/includes/configure.php
chmod 777 /var/www/html/admin/includes/configure.php
特别奇怪,明明都已经安装完成了。 直接修改代码 mysql 修改成 mysqli 。没有 mysql的插件,都叫 mysqli 了。
bash#/install/templates/pages/index.php 163 把插件修改成 mysqli
if (!extension_loaded('mysqli')) {
$warning_array['mysql'] = 'The MySQL extension is required but is not installed. Please enable it to continue installation.';
}
数据库插入表错误,去掉 DEFAULT '0000-00-00 00:00:00' 配置,
bashCREATE TABLE customers (
customers_id int NOT NULL auto_increment,
customers_gender char(1),
customers_firstname varchar(255) NOT NULL,
customers_lastname varchar(255) NOT NULL,
customers_dob datetime DEFAULT '0000-00-00 00:00:00' NOT NULL,
customers_email_address varchar(255) NOT NULL,
customers_default_address_id int,
customers_telephone varchar(255) NOT NULL,
customers_fax varchar(255),
customers_password varchar(60) NOT NULL,
customers_newsletter char(1),
PRIMARY KEY (customers_id),
KEY idx_customers_email_address (customers_email_address)
) CHARACTER SET utf8 COLLATE utf8_unicode_ci;
去掉 DEFAULT '0000-00-00 00:00:00' 配置
或者设置mysql 模式:
bashsql_mode=ONLY_FULL_GROUP_BY,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
然后配置数据库,直接是docker-compose 地址:
设置网站地址:
设置网站名称和管理员密码:都是 admin
安装成功!
php7 里面有很多函数不支持,使用了很多老的函数呢。
切换到 php5 可以执行,但报错:
解决方法:
在mysql的配置文件中加入以下配置即可(加入后建议关闭phpstudy进行重启系统)
sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
解决了。
或者修改 php-fpm 的配置:
bashDeprecated: Function get_magic_quotes_gpc() is deprecated in /var/www/html/includes/functions/compatibility.php on line 46
Deprecated: The each() function is deprecated. This message will be suppressed on further calls in /var/www/html/includes/functions/compatibility.php on line 22
Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; shoppingCart has a deprecated constructor in /var/www/html/includes/classes/shopping_cart.php on line 13
Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; navigationHistory has a deprecated constructor in /var/www/html/includes/classes/navigation_history.php on line 13
修改配置隐藏错误警告信息即可:
bashphp_flag[display_errors] = off
也可以登陆管理后台:
功能还是非常的复杂的。有很多的配置展示,都是英文版本的。
数据库一共有 50 张表。
经过几天的研究,终于弄明白了php的环境如何配置成功了。 这个是很古老的开源项目了,数据库比较少,同时源代码都放到文件里面了。 最新的osCommerce4,文件大很多,而且GPL的开源协议。 但是 osCommerce2,因为比较老的项目了所以是MIT开源的。
https://github.com/osCommerce/oscommerce2/blob/master/LICENSE.md
可以进行学习研究,毕竟9年前的产品了,相关的代码设计,架构,技术栈都非常的老了。 但是不影响学习。使用的是jqueryUI,刷新页面的方式进行开发的。
页面更新:2024-05-17
本站资料均由网友自行发布提供,仅用于学习交流。如有版权问题,请与我联系,QQ:4156828
© CopyRight 2008-2024 All Rights Reserved. Powered By bs178.com 闽ICP备11008920号-3
闽公网安备35020302034844号