我有一个脚本,其中一部分运行命令行进程,如果直接在服务器上运行(Windows 2008),只需不到一秒钟。
通过exec()、passthru()或system()运行它需要超过30秒,但是输出确认过程本身花费了0.5秒,就像在服务器上直接运行时一样。
样本Exec
shell_exec(path\to\software path\to\file -sqldata "SELECT * FROM table WHERE this = that" -f "path\to\output" -c path\to\config -e PDF -ec proof -o "Proof")样本响应
Inspire Designer Console 10.0 SP1 Production System
Net license (192.168.20.102)
License is valid till 2017-06-30.
Opening workflow path\to\file 2.8.2016 9:01:08.412.
Status message 0881:Reading config file path\to\config.
Status message 0884:Running module Proof.
Status message 0243:ODBC Data Input: Executing: SELECT * FROM table WHERE this = that
Status message 0246:ODBC Data Input: Reading completed with 1 records (data)
Status message 0045:Data opened (duration 0:00:00.015, records 1).
Status message 0045:Data opened (duration 0:00:00.000, records 1).
Status message 0645:Job started (engine PDF, range 1-end, copies 1, file path\to\output).
Warning 0062:Page Page 1 uses output name Main with different size. Using bigger.
Warning 5505:PDF: Optimization for fast web view enabled. The spooling time can grow significantly.
Status message 5506:PDF: Linearization in progress.
Status message 0003:Job finished (duration 0:00:00.234, sheets 1, sheets/min 256.41).
Complete run time: 0:00:00.483.是否有可行的替代方案,或改进exec()函数的“初始化”时间以提高站点加载时间?
发布于 2016-08-02 09:18:34
编辑:
试试这个:
Proc_Close (Proc_Open ("path\to\software --field=1 &", Array (), $field));前面的答案,它应用了一个注释:
我总是用:
system('echo . | path\to\software path\to\file ect...');很快就开始了。
https://stackoverflow.com/questions/38715995
复制相似问题