禅道安装
5802

禅道能否安装到非opt目录已解决 悬赏5积分

提问者陈建忠 答案数1 阅读数4274 发表时间2018-04-11 17:42:49
我们没opt目录的操作权限,需要更换到其他目录,我们解压后,调整zxob、zxob.php文件夹中目录路径,执行启动时报识别不lPHP,请大神指点

禅道版本:9.8.2

安装包类型:Linux安装包

操作系统:Other

客户端浏览器:IE11

备注





zbox.php

----------------------------------------------------------------------------

#!/home/middleware/chenjz/zbox/bin/php
<?php
array_shift($argv);
$flipArgv = array_flip($argv);
$basePath = dirname(__FILE__);

if($basePath != '/home/middleware/chenjz/zbox') die("Run it in path /home/middleware/chenjz/zbox/\n");
if(empty($argv) or isset($flipArgv['--help']) or isset($flipArgv['-h']))
{
    echo <<<EOD
Usage: zbox.php {start|stop|restart|status}

Options:
    -h --help Show help.
    -ap --aport Apache port, default 80.
    -mp --mport Mysql port, default 3306.

EOD;
    exit;
}

if(is_dir("$basePath/app/zentao/"))
{
    `chmod -R 777 $basePath/app/zentao/tmp`;
    `chmod -R 777 $basePath/app/zentao/www/data`;
}
if(is_dir("$basePath/app/zentaopro/"))
{
    `chmod -R 777 $basePath/app/zentaopro/tmp`;
    `chmod -R 777 $basePath/app/zentaopro/www/data`;
}
if(is_dir("$basePath/app/zentaoep/"))
{
    `chmod -R 777 $basePath/app/zentaoep/tmp`;
    `chmod -R 777 $basePath/app/zentaoep/www/data`;
}

/* Process argv. */
$params = array();
foreach($flipArgv as $key => $val)
{
    if(strpos($key, '-') !== 0) continue;
    if($key == '--aport') $key = '-ap';
    if($key == '--mport') $key = '-mp';
    if(isset($argv[$val + 1]) and is_numeric($argv[$val + 1]))
    {
        $params[$key] = $argv[$val + 1];
        unset($argv[$val]);
        unset($argv[$val + 1]);
    }
}

if(isset($params['-ap'])) changePort($basePath . '/etc/apache/httpd.conf', $params['-ap'], array('^Listen +([0-9]+)', '<VirtualHost +.*:([0-9]+)>'));

if(isset($params['-mp']))
{
    changePort($basePath . '/etc/mysql/my.cnf', $params['-mp'], '^port *= *([0-9]+)');
    changePort($basePath . '/app/htdocs/index.php', $params['-mp'], 'localhost\:([0-9]+)\&');

    $myReg = '^\$config->db->port *= *.([0-9]+)..*;';
    if(file_exists("$basePath/app/zentao/config/my.php"))
    {
        `chmod 777 $basePath/app/zentao/config/my.php`;
        $myFile = "$basePath/app/zentao/config/my.php";
        changePort($myFile, $params['-mp'], $myReg);
    }
    if(file_exists("$basePath/app/zentaopro/config/my.php"))
    {
        `chmod 777 $basePath/app/zentaopro/config/my.php`;
        $myFile = "$basePath/app/zentaopro/config/my.php";
        changePort($myFile, $params['-mp'], $myReg);
    }
    if(file_exists("$basePath/app/zentaoep/config/my.php"))
    {
        `chmod 777 $basePath/app/zentaoep/config/my.php`;
        $myFile = "$basePath/app/zentaoep/config/my.php";
        changePort($myFile, $params['-mp'], $myReg);
    }
    if(file_exists("$basePath/app/chanzhi/s y s t e m/config/my.php"))
    {
        `chmod 777 $basePath/app/chanzhi/config/my.php`;
        $myFile = "$basePath/app/chanzhi/s y s t e m/config/my.php";
        changePort($myFile, $params['-mp'], $myReg);
    }
    if(file_exists("$basePath/app/ranzhi/config/my.php"))
    {
        `chmod 777 $basePath/app/ranzhi/config/my.php`;
        $myFile = "$basePath/app/ranzhi/config/my.php";
        changePort($myFile, $params['-mp'], $myReg);
    }
}

if(!empty($argv)) $params['-k'] = reset($argv);
if(isset($params['-k']))
{
    if(strpos(file_get_contents('/etc/group'), 'nogroup') === false) echo `groupadd nogroup`;
    if(strpos(file_get_contents('/etc/passwd'), 'nobody') === false) echo `useradd nobody`;
    `chmod -R 777 $basePath/tmp`;
    `chmod -R 777 $basePath/logs`;
    `chown -R nobody $basePath/data/mysql`;

    switch($params['-k'])
    {
    case 'start':
        $httpd = `ps aux|grep '\/home\/middleware\/chenjz\/zbox\/run\/apache\/httpd '`;
        if($httpd)
        {
            echo "Apache is running\n";
        }
        else
        {
            echo `$basePath/run/apache/apachectl start`;
            sleep(2);
            $httpd = `ps aux|grep '\/home\/middleware\/chenjz\/zbox\/run\/apache\/httpd '`;
            echo empty($httpd) ? "Start Apache fail. You can see the log/home/middleware/chenjz/zbox/logs/apache_error.log\n" : "Start Apache success\n";
        }

        $mysql = `ps aux|grep '\/home\/middleware\/chenjz\/zbox\/run\/mysql\/mysqld '`;
        if($mysql)
        {
            echo "Mysql is running\n";
        }
        else
        {
            echo `$basePath/run/mysql/mysql.server start --defaults-file=$basePath/etc/mysql/my.cnf`;
            sleep(2);
            $mysql = `ps aux|grep '\/home\/middleware\/chenjz\/zbox\/run\/mysql\/mysqld '`;
            echo empty($mysql) ? "Start Mysql fail. You can see the log/home/middleware/chenjz/zbox/logs/mysql_error.log\n"   : "Start Mysql success\n";
        }
        break;
    case 'stop':
        $httpd = `ps aux|grep '\/home\/middleware\/chenjz\/zbox\/run\/apache\/httpd '`;
        if($httpd)
        {
            echo `$basePath/run/apache/apachectl stop`;
            sleep(2);
            $httpd = `ps aux|grep '\/home\/middleware\/chenjz\/zbox\/run\/apache\/httpd '`;
            echo empty($httpd) ? "Stop Apache success\n" : "Stop Apache fail. You can see the log/home/middleware/chenjz/zbox/logs/apache_error.log\n";
        }
        else
        {
            echo "Apache is not running\n";
        }

        $mysql = `ps aux|grep '\/home\/middleware\/chenjz\/zbox\/run\/mysql\/mysqld '`;
        if($mysql)
        {
            echo `$basePath/run/mysql/mysql.server stop`;
            sleep(2);
            $mysql = `ps aux|grep '\/home\/middleware\/chenjz\/zbox\/run\/mysql\/mysqld '`;
            echo empty($mysql) ? "Stop Mysql success\n"  : "Stop Mysql fail. You can see the log/home/middleware/chenjz/zbox/logs/mysql_error.log\n";
        }
        else
        {
            echo "Mysql is not running\n";
        }
        break;
    case 'restart':
        echo `$basePath/run/apache/apachectl restart`;
        sleep(2);
        $httpd = `ps aux|grep '\/home\/middleware\/chenjz\/zbox\/run\/apache\/httpd '`;
        echo empty($httpd) ? "Restart Apache fail. You can see the log/home/middleware/chenjz/zbox/logs/apache_error.log\n" : "Retart Apache success\n";

        echo `$basePath/run/mysql/mysql.server restart --defaults-file=$basePath/etc/mysql/my.cnf`;
        sleep(2);
        $mysql = `ps aux|grep '\/home\/middleware\/chenjz\/zbox\/run\/mysql\/mysqld '`;
        echo empty($mysql) ? "Restart Mysql fail. You can see the log/home/middleware/chenjz/zbox/logs/mysql_error.log\n"   : "Retart Mysql success\n";
        break;
    case 'status':
        $httpd = `ps aux|grep '\/home\/middleware\/chenjz\/zbox\/run\/apache\/httpd '`;
        $mysql = `ps aux|grep '\/home\/middleware\/chenjz\/zbox\/run\/mysql\/mysqld '`;
        echo empty($httpd) ? "Apache is not running\n" : "Apache is running\n";
        echo empty($mysql) ? "Mysql is not running\n" : "Mysql is running\n";
    }
}

function changePort($file, $port, $regs)
{
    if(!is_array($regs)) $regs = array($regs);
    $lines = file($file);
    foreach($lines as $i => $line)
    {
        foreach($regs as $reg)
        {
            if(preg_match("/$reg/", $line, $matches)) $lines[$i] = str_replace($matches[1], $port, $line);
        }
    }
    file_put_contents($file, join($lines));
}














zbox

--------------------------------------------------------------------

#!/bin/bash
export LD_LIBRARY_PATH=/home/middleware/chenjz/zbox/run/
/home/middleware/chenjz/zbox/bin/php /home/middleware/chenjz/zbox/zbox.php $*




设置备注
内容
答案列表
🚢
2018-04-11 18:06:42

linux一键安装包只能安装在/opt目录下的。

如果需要安装在其他目录可以自搭建php mysql apache/nginx环境,使用源码包进行安装部署。

联系我们
联系人
刘斌/高级客户经理
电话(微信)
17685869372
QQ号码
526288068
联系邮箱
liubin@chandao.com
返回顶部
刘斌
高级客户经理
17685869372
526288068
统一服务热线 4006-8899-23
我要提问提问有任何问题,您都可以在这里提问。 问题反馈反馈点击这里,让我们聆听您的建议与反馈。