部署PHP开源项目SuiteCRM
前言
因人力资源部想要开发一套适用于他们方便管理的系统,但无整体构思,在网络中找到了开源企业管理软件SuiteCRM,想要作为参考,因此委托我们研发中心,部署系统。这个任务恰好被我接手,很惊讶是一个PHP项目,初次接触PHP项目的部署,特此记录、分享。
GitHub地址:https://github.com/salesagility/SuiteCRM
发现一份 企业管理软件:镜像部署与使用实战
手册,很不错: https://www.kancloud.cn/websoft9/enterprise-software-practice
部署PHP项目
曾使用宝塔,发现其软件商店有PHP项目,且能傻瓜式的部署,印象深刻,故借助宝塔进行部署PHP项目。
创建站点
在宝塔面板,网站项,添加一个站点,填写如下内容:
查看网站目录,确定网站文件数据存放位置 由于创建站点,默认站点监听80端口,但其已被使用,故修改站点端口
上传PHP源码
进入网站目录 上传PHP源码,然后解压内容到根目录
安装依赖
接着访问:IP:8081
,会提示执行命令:composer install
回到站点设置,若Composer版本显示非版本号,则升级Composer,然后执行如图所示设置
在执行过程中遇到了如下异常:
Reading ./composer.lock (/www/wwwroot/abc.com/composer.lock)
Installing dependencies from lock file (including require-dev)
Verifying lock file contents can be installed on current platform.
Reading ./composer.lock (/www/wwwroot/abc.com/composer.lock)
Built pool.
Generating rules
Resolving dependencies through SAT
Dependency resolution completed in 0.001 seconds
Your lock file does not contain a compatible set of packages. Please run composer update.
Problem 1
- Root composer.json requires PHP extension ext-zip * but it is missing from your system. Install or enable PHP's zip extension.
Problem 2
- league/uri is locked to version 4.2.3 and an update of this package was not requested.
- league/uri 4.2.3 requires ext-fileinfo * -> it is missing from your system. Install or enable PHP's fileinfo extension.
Problem 3
- php-webdriver/webdriver is locked to version 1.13.1 and an update of this package was not requested.
- php-webdriver/webdriver 1.13.1 requires ext-zip * -> it is missing from your system. Install or enable PHP's zip extension.
Problem 4
- php-webdriver/webdriver 1.13.1 requires ext-zip * -> it is missing from your system. Install or enable PHP's zip extension.
- codeception/module-webdriver 1.4.1 requires php-webdriver/webdriver ^1.8.0 -> satisfiable by php-webdriver/webdriver[1.13.1].
- codeception/module-webdriver is locked to version 1.4.1 and an update of this package was not requested.
按提示:Please run composer update
,执行 composer update
,发现任然报错:
Reading /home/www/.cache/composer/repo/https---mirrors.aliyun.com-composer/provider-masterminds~html5~dev.json from cache
Downloading https://mirrors.aliyun.com/composer/p2/masterminds/html5~dev.json if modified
Reading /home/www/.cache/composer/repo/https---mirrors.aliyun.com-composer/provider-phpdocumentor~reflection-common~dev.json from cache
[304] https://mirrors.aliyun.com/composer/p2/masterminds/html5~dev.json
[304] https://mirrors.aliyun.com/composer/p2/masterminds/html5.json
Built pool.
Running pool optimizer.
Pool optimizer completed in 1.154 seconds
Found 8,136 package versions referenced in your dependency graph. 6,937 (85%) were optimized away.
Updating dependencies
Generating rules
Resolving dependencies through SAT
Dependency resolution completed in 0.002 seconds
Your requirements could not be resolved to an installable set of packages.
Problem 1
- Root composer.json requires PHP extension ext-zip * but it is missing from your system. Install or enable PHP's zip extension.
Problem 2
- Root composer.json requires league/uri ^4.2.3 -> satisfiable by league/uri[4.2.3].
- league/uri 4.2.3 requires ext-fileinfo * -> it is missing from your system. Install or enable PHP's fileinfo extension.
Problem 3
- php-webdriver/webdriver[1.8.0, 1.8.1, 1.8.2, 1.8.3, 1.9.0, 1.10.0, 1.11.0, 1.11.1, 1.12.0, 1.12.1, 1.13.0, 1.13.1, 1.13.x-dev, 1.14.0, 1.14.1] require ext-zip * -> it is missing from your system. Install or enable PHP's zip extension.
- codeception/module-webdriver[1.2.0, 1.2.1, 1.2.2, 1.3.0, 1.4.0, 1.4.1, 1.x-dev] require php-webdriver/webdriver ^1.8.0 -> satisfiable by php-webdriver/webdriver[1.8.0, 1.8.1, 1.8.2, 1.8.3, 1.9.0, 1.10.0, 1.11.0, 1.11.1, 1.12.0, 1.12.1, 1.13.0, 1.13.1, 1.13.x-dev, 1.14.0, 1.14.1].
- Root composer.json requires codeception/module-webdriver ^1.2 -> satisfiable by codeception/module-webdriver[1.2.0, 1.2.1, 1.2.2, 1.3.0, 1.4.0, 1.4.1, 1.x-dev].
经过一番折腾得以解决,只需要执行命令时,添加额外参数:
composer install --ignore-platform-req=ext-fileinfo
同时,使用root用户执行该命令 当执行成功会有如下提示:
注意:可以直接进入项目源代码目录执行以上操作相关命令
,效果等同于上述界面操作。
SuiteCRM安装
安装向导
浏览器访问:http://域名
或 http://公网IP
,进入安装向导,然后选择接受协议,进入下一步
环境检测会自动通过,选择Next进入下一步,进入配置数据库界面(默认数据库为:suitecrm)。然后设置管理员账号,点击“安装”
注意:在创建站点时,有创建数据库,这里需要修改其访问权限
系统进入安装过程,耐心等待,安装成功后系统会进行提示
至此,PHP项目安装完毕。
中文语言
SuiteCRM默认安装只有英文,需要中文或其他语言,需要下载语言包,然后通过后台进行安装
下载中文语言包: https://crowdin.com/project/suitecrmtranslations/zh-CN
以Admin身份进入SuiteCRM,然后在所示位置进入系统管理界面
在进入Module Loader
过程中,可能出现跨站请求伪造 (XSRF) 攻击异常
只需要在项目根目录的config_override.php
文件中进行配置即可,如果它不存在,请创建它
$sugar_config['http_referer']['list'][] = 'IP';
上传中文语言包 开始安装 提交安装 中文简体语言包安装完成之后,回到SuiteCRM界面登录时,会发现默认的语言是英文,只有通过下拉列表选择才可以选择中文简体。 在系统管理项,设置中文简体为默认语言 使用管理员帐户登录到SuiteCRM后台,进入系统管理——区域界面,找到语言,选择中文简体即可。 进入管理员帐号,系统管理 ——语言,通过拖拽把英文语言禁用。 再次回到登录界面,发现默认语言已设置为中文
修改数据库密码
因为SuiteCRM在安装的时候已经将数据库账号信息写到配置文件中,若后续修改数据库密码,配置文件不会自动更新
只需要修改配置文件/www/wwwroot/abc.com/config.php
对应的db_password
参数即可:
'dbconfig' =>
array (
'db_host_name' => 'IP',
'db_host_instance' => 'SQLEXPRESS',
'db_user_name' => 'abc_com',
'db_password' => 'sD83K4HZFx7Hibkn',
'db_name' => 'abc_com',
'db_type' => 'mysql',
'db_port' => '',
'db_manager' => 'MysqliManager',
'collation' => 'utf8mb4_general_ci',
'charset' => 'utf8mb4',
),
转载自:https://juejin.cn/post/7229691976605859899