2017-02-09 37 views
0

直到昨天,我用我们的生产服务器(CentOS 6.8),PHPDocumentor版本2.8.5。一切正常。我不得不升级到版本2.9.0。因为PHPDoc无法生成PHP7的文档。从CLI调用无限循环PHPDocumentor(但通过SSH调用)(但通过SSH罚款)

当我运行通过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 

enter image description here

但是,当我尝试用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); 

是任何人都经历了类似的问题?

回答

0

我带了两天的辛勤工作,但终于找到了问题的根源。

  1. phpDocumentor.phar需要在执行前调用PHP命令。

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

不知何故,如果找不到那些命令之一,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" 
+0

下面是我能够安装phpDocumentor 2.9.0。没有'pear' http://askubuntu.com/a/811577/575247 –

+0

当我在包含PHPDocumentor的Composer中观察到类似的东西。作曲家只是挂起。 –