Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/285.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
从CLI调用时与PHPDocumentor的无限循环(但可以通过SSH调用)_Php_Centos_Infinite Loop_Phpdoc_Phpdocumentor2 - Fatal编程技术网

从CLI调用时与PHPDocumentor的无限循环(但可以通过SSH调用)

从CLI调用时与PHPDocumentor的无限循环(但可以通过SSH调用),php,centos,infinite-loop,phpdoc,phpdocumentor2,Php,Centos,Infinite Loop,Phpdoc,Phpdocumentor2,到昨天为止,我在生产服务器(CentOS 6.8)上使用了PHPDocumentor 2.8.5版。一切都很顺利。我必须升级到2.9.0版。因为PHPDoc无法生成PHP7的文档 当我通过SSH运行以下脚本时,一切正常: /[not_a_real_path]/phpdoc --directory=/[not_a_real_path]/gem-mechanic/ --target=/[not_a_real_path]/PC_administration_interface/documentatio

到昨天为止,我在生产服务器(CentOS 6.8)上使用了PHPDocumentor 2.8.5版。一切都很顺利。我必须升级到2.9.0版。因为PHPDoc无法生成PHP7的文档

当我通过SSH运行以下脚本时,一切正常:

/[not_a_real_path]/phpdoc --directory=/[not_a_real_path]/gem-mechanic/ --target=/[not_a_real_path]/PC_administration_interface/documentation/gem-mechanic/ --title="GEM-MECHANIC"

/[not_a_real_path]/phpdoc --directory=/[not_a_real_path]/PC_administration_interface/ --target=/[not_a_real_path]/PC_administration_interface/documentation/pc_administration_interface/ --title="PC-ADMINISTRATION-INTERFACE"

/[not_a_real_path]/phpdoc --directory=/[not_a_real_path]/setup/modules/appointmentmanager/ --target=/[not_a_real_path]/PC_administration_interface/documentation/prestashop_appointmentmanager/ --title="PRESTASHOP: APPOINTMENT MANAGER"

/[not_a_real_path]/phpdoc --directory=/[not_a_real_path]/setup/modules/datalinkmanager/ --target=/[not_a_real_path]/PC_administration_interface/documentation/prestashop_datalinkmanager/ --title="PRESTASHOP: DATALINK MANAGER"

/[not_a_real_path]/phpdoc --directory=/[not_a_real_path]/setup/modules/sharedcode/ --target=/[not_a_real_path]/PC_administration_interface/documentation/prestashop_sharedcode/ --title="PRESTASHOP: SHARED CODE"

/[not_a_real_path]/phpdoc --directory=/[not_a_real_path]/setup/modules/vehiclefile/ --target=/[not_a_real_path]/PC_administration_interface/documentation/prestashop_vehiclefile/ --title="PRESTASHOP: VEHICLE FILE"

/[not_a_real_path]/phpdoc --directory=/[not_a_real_path]/shared_code/ --target=/[not_a_real_path]/PC_administration_interface/documentation/shared_code/ --title="SHARED CODE"

echo Options All -Indexes > /[not_a_real_path]/PC_administration_interface/documentation/.htaccess
echo AuthType Basic >> /[not_a_real_path]/PC_administration_interface/documentation/.htaccess
echo AuthName '"Please login"' >> /[not_a_real_path]/PC_administration_interface/documentation/.htaccess
echo AuthUserFile /[not_a_real_path]/PC_administration_interface/.htpasswd >> /[not_a_real_path]/PC_administration_interface/documentation/.htaccess
echo Require valid-user >> /[not_a_real_path]/PC_administration_interface/documentation/.htaccess

但是,当我尝试用PHP运行脚本时

public static function generateDocumentation() 
{
    $output = array();

    set_time_limit(180);

    self::createDocDirectory();

    exec(self::getScriptPath(false) . " 2>&1", $output);

    return implode($output, PHP_EOL);
}
编码陷入无限循环,不生成任何文档。我希望页面在3分钟后失败,但它只是继续循环

即使尝试执行PHPDocumentor,它也会陷入无限循环:

exec("[not_the_real_path]/phpdoc 2>&1", $output);

有没有人遇到过类似的问题?

我花了两天的时间努力工作,但我终于找到了问题的根源

  • phpDocumentor.phar
    要求在执行之前调用PHP命令

  • 如果PHP命令不在包含的路径中,则需要提供完整路径

  • 不知何故,如果找不到其中一个to命令,CLI就会挂起

    下面是一个有效命令的示例:

    exec("/usr/local/bin/php /usr/local/bin/phpDocumentor-2.9.phar --directory=/home/gem/public_html/gem-mechanic/ --target=/home/gem/public_html/PC_administration_interface/documentation/gem-mechanic/ --title=\"GEM-MECHANIC\" 2>&1", $output);
    
    注意:添加以下代码行:

    PATH="/usr/local/bin"
    
    在脚本开始时,您不需要调用PHP,也不需要包含到达phpDocumentor的路径。脚本中的一行可以简单地写成这样:

    phpDocumentor-2.9.phar --directory=/home/gem/public_html/gem-mechanic/ --target=/home/gem/public_html/PC_administration_interface/documentation/gem-mechanic/ --title="GEM-MECHANIC"
    

    下面是我如何安装PHPDocumentor2.9.0的。如果没有pear,当我在Composer中加入PHPDocumentor时,我观察到了类似的情况。作曲家只是挂断了。