Linux+testlink服务器搭建详细教程
一、安装准备 进入root权限
二、安装yum apt-get install yum
三、安装apache服务
(1)更新文件 yum -y update
(2)安装apache yum install httpd
(3)修改配置信息 vim /etc/httpd/conf/httpd.conf
(1)把里面的 AllowOverride None 全部修改为 AllowOverride All
(2)顺便在 DirectoryIndex index.html 后面加上 index.htm index.php index.shtm
(3)直接修改/etc/httpd/conf/httpd.conf中修改DocumentRoot和Directory处的路径、重启即 可
(4)重启apache服务 systemctl restart httpd.service #重启apache
(5)让配置立即生效 setenforce 0 #使配置立即生效
(6)根据需要开启或关闭防火墙 systemctl stop firewalld.service //关闭firewall systemctl start firewalld.service //开启firewall systemctl disable firewalld.service //禁止firewall开机启动
四、安装PHP
(1)安装 yum -y install php-gd php-ldap php-odbc php-pear php-xml php-xmlrpc
php-mbstring php-snmp php-soap curl curl-devel
(2)重启apache服务 systemctl restart httpd.service
(3)写一个php文件在浏览器中运行一下: file: vi /var/www/html/info.php content: 浏览器输入:http://192.168.1.1/info.php
五、安装MySQL
(1)安装 yum -y install mariadb*
(2)开启MySQL服务 systemctl start mariadb.service
(3)设置开机启动MySQL服务 systemctl enable mariadb.service
(4)设置root账号的密码 mysql_secure_installation 然后会出现一串东西,可以仔细读一下, 如果你懒得读,就在提示出来的时候,按Enter就好了,让你设置密码的时候,你就输入你想要的密码就行,然后继续在让你选择y/n是,Enter就好了;当一切结束的时候,你可以输入mysql -uroot -p的方式,验证一下 六、将PHP和MySQL关联起来 yum search php,选择你需要的安装:yum -y install php-mysql
注:源码无法编辑情况需要执行命令:yum install mod_php -y
六、将PHP和MySQL关联起来 yum search php,选择你需要的安装:yum -y install php-mysql
七. 配置testlink
修改目录名
[[email protected] ~]#mv testlink-1.9.5 testlink
修改目录访问权限
[[email protected] ~]#chmod –R 755 testlink
[[email protected] ~]#chown –R apache:apache testlink
配置testlink日志目录和附件目录
[[email protected] ~]#mkdir -p /var/testlink/logs/
[[email protected] ~]#mkdir -p /var/testlink/upload_area/
[[email protected] ~]#chmod -R 777 /var/testlink
[[email protected] ~]#chown –R apache:apache /var/testlink
八.访问http://ip地址/testlink
(1)点击new install
(2)点击continue
(3)如无报错,continue
如图所示报错,解决方案:
# vi /etc/php.ini
修改:session.gc_maxlifetime = 60000
修改:max_execution_time = 120
用例执行报错:
1. 错误描述:Fatal error: Uncaught Error: Cannot use string offset as an array in C:\xampp\htdocs\testlink\lib\execute\execSetResults.php:1534 Stack trace: #0 C:\xampp\htdocs\testlink\lib\execute\execSetResults.php(94): processTestCase(NULL, Object(stdClass), Object(stdClass), Object(stdClass), Array, Object(tree), Object(testcase), Object(tlAttachmentRepository)) #1 {main} thrown in /www/testlink/lib/execute/execSetResults.php on line 1533
解决方案
首先:打开execSetResults.php ,定位到1511 附近,找到$guiObj->design_time_cfields=''
再则:把$guiObj->design_time_cfields=''改为$guiObj->design_time_cfields=[]
2.错误描述
页面显示不全,报错:
“Deprecated : ...... phpmailer/PHPMailerAutoload.php on line 45”
解决方案:
将function__autoload($classname)修改为:
functionspl_autoload_register($classname)
3.错误描述
执行结果显示报错,报错信息:
Fatal error: Uncaught Error: Call to undefined function bcmul() in /www/testlink/lib/results/resultsByTesterPerBuild.php:295 Stack trace: #0 /www/testlink/lib/results/resultsByTesterPerBuild.php(81): minutes2HHMMSS(0) #1 {main} thrown in /www/testlink/lib/results/resultsByTesterPerBuild.php on line 295
解决方案:
缺少php-bcmath扩展
# cd /usr/local/src/php7.2/ext/bcmath
# /usr/locla/php/bin/phpize
# ./configure --with-php-config=/usr/local/php/bin/php-config
# make && make install
# vi /usr/local/php/lib/php.ini
添加extension=bcmath.so
保存后重启php服务即可解决
4.错误描述
测试结果flat页面报错,报错信息:
Fatal error: 'break' not in the 'loop' or 'switch' context in /www/testlink/third_party/codeplex/PHPExcel/Calculation/Functions.php on line 570
解决方案:
} elseif(is_array($value)) {
return 64;
报道PHP文件,删除570行处的break;
5.错误描述
安装页面报错:
Failed! LDAP library not enabled. LDAP authentication cannot be used. (default internal authentication will works).
解决方案:
进入php安装文件下
# cd /usr/local/src/php7.2/ext/ldap
# /usr/local/php/bin/phpize
# ./configure --with-php-config=/usr/local/php/bin/php-config --with-ldap
报错信息:
configure: error: Cannot find ldap.h
解决办法:
# yum install -y openldap openldap-devel
报错信息:
configure: error: Cannot find ldap libraries in /usr/lib
解决办法:
# cp -frp /usr/lib64/libldap* /usr/lib/
# ./configure --with-php-config=/usr/local/php/bin/php-config --with-ldap
安装完成后修改php配置文件
# vi /usr/local/php/lib/php.ini
将extension=ldap.so前的分号去掉,保存退出 ,或添加该配置