关键字:opencart、安装、linux、2.3.0.2
时间:2017年

目录

1. 运行环境介绍
2. 操作系统准备
3. 安装apache2和php5
4. 配置apache2
5. 下载opencart
6. 解压与拷贝
7. 修改配置文件名
8. 进入安装页面
9. 安装php扩展
10. 修改配置文件权限
11. 修改其他文件权限
12. 浏览器继续安装
13. 安装mysql
14. 配置mysql
15. 安装php的mysql扩展
16. 浏览器继续安装
17. 完成并清理安装目录

1. 运行环境介绍

项目 版本 备注
debian 8.7.1
apache2 2.4.10
php5 5.6.30
mysql 5.5.55
opencart 2.3.0.2 多语言版

2. 操作系统准备

操作系统安装请参考其他文章。

3. 安装apache2和php5

root@debian:~# apt-get update
root@debian:~# apt-get install php5 apache2

4. 配置apache2

root@debian:~# vim /etc/apache2/site-enabled/000-default.conf
...
#DocumentRoot /var/www/html
DocumentRoot /var/www
...
root@debian:~# systemctl restart apache2

5. 下载opencart

下载页面地址:http://www.opencartchina.com/download.html

root@debian:~# wget https://github.com/mycncart/opencart_international/archive/opencart_international_2.3.0.2.zip

6. 解压与拷贝

root@debian:~# apt-get install unzip
root@debian:~# unzip opencart_international_2.3.0.2.zip
root@debian:~# cp -r opencart_international-opencart_international_2.3.0.2/* /var/www/

7. 修改配置文件名

root@debian:~# cd /var/www
root@debian:/var/www# mv config-dist.php config.php
root@debian:/var/www# mv admin/config-dist.php admin/config.php

8. 进入安装页面

浏览器打开:http://你服务器的ip地址/
“1/4 License agreement”页面,点击continue按钮。
“2/4 Pre-Installation”页面,有许多检查项未通过,回到linux。

9. 安装php扩展

root@debian:/var/www# apt-get install php5-gd php5-curl php5-mcrypt
root@debian:/var/www# systemctl reload apache2

10. 修改配置文件权限

root@debian:/var/www# chown www-data:www-data /var/www/config.php
root@debian:/var/www# chown www-data:www-data /var/www/admin/config.php

11. 修改其他文件权限

root@debian:/var/www# chown www-data:www-data /var/www/image/
root@debian:/var/www# chown www-data:www-data -R /var/www/image/cache/
root@debian:/var/www# chown www-data:www-data -R /var/www/image/catalog/
root@debian:/var/www# chown www-data:www-data -R /var/www/system/storage/cache/
root@debian:/var/www# chown www-data:www-data -R /var/www/system/storage/logs/
root@debian:/var/www# chown www-data:www-data -R /var/www/system/storage/download/
root@debian:/var/www# chown www-data:www-data -R /var/www/system/storage/upload/
root@debian:/var/www# chown www-data:www-data -R /var/www/system/storage/modification/

12. 浏览器继续安装

“2/4 Pre-Installation”页面,刷新,所有检查项通过。
“3/4 Configuration”页面,

13. 安装mysql

mysql安装请参考其他文章。

14. 配置mysql

root@debian:/var/www# mysql -uroot -p
mysql> create database shop001 default charset=utf8;
mysql> use mysql;
mysql> grant all privileges on shop001.* to opencart@'%' identified by '123456';

15. 安装php的mysql扩展

root@debian:/var/www# apt-get install php5-mysql
root@debian:/var/www# systemctl restart apache2

16. 浏览器继续安装

1. Please enter your database connection details.
DB Driver: mPDO
Hostname: localhost
Username: opencart
Password: 123456
Database: shop001
Port: 3306
Prefix: oc_
2. Please enter a username and password for the administration.
Username: admin
Passsword: abcd1234
E-mail: webmaster@xx.com

17. 完成并清理安装目录

4/4Installation complete

root@debian:/var/www# rm -r install/

关键字:php、curl、apns、推送、http2
时间:2017年4月

PHP代码

<?php
ini_set('display_errors', 1);

$service_url = 'https://api.push.apple.com/3/device/';
$token = '07cd****3217****6289****94999228d7b45339fbafdf08****8f83****499b';
$headers = array();
$header[] = 'apns-topic:com.xxxxx.xxapp'; // bundle-id
$payload = '{"aps":{"alert":"hello","sound":"msg_high.m4a"}}';

$ch = curl_init();
curl_setopt($ch, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_2_0);
curl_setopt($ch, CURLOPT_SSLCERT, '/var/www/cer.pem'); // HTTP/2推送证书
curl_setopt($ch, CURLOPT_SSLCERTPASSWD, '');           // 证书没有密码
curl_setopt($ch, CURLOPT_URL, $service_url . $token);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_POSTFIELDS, $payload);
curl_setopt($ch, CURLOPT_HEADER, TRUE);                // 显示response头
curl_setopt($ch, CURL_RETURNTRANSFER, 1);

$result = curl_exec($ch);

curl_close($ch);

echo $result;
?>

结果

HTTP/2 200 apns-id: 5149B14A-0CB2-B045-8EE9-3C21ECB13FBC