Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PHP exec执行ljudge #23

Open
AmazingDaFaFa opened this issue May 1, 2021 · 2 comments
Open

PHP exec执行ljudge #23

AmazingDaFaFa opened this issue May 1, 2021 · 2 comments

Comments

@AmazingDaFaFa
Copy link

在CentOS 7环境下正常安装lrun v1.2.1和ljudge v0.6.1,使用自定义用户和www用户在bash中ljudge --check均通过检查。
然而通过exec('ljudge --check')语句运行时,系统提示未安装lrun。
请问是我在运行过程中缺少某些权限吗?

@quark-zju
Copy link
Owner

可以检查一下 PHP 中 PATH 环境变量是什么,是否和 PHP 环境外相同。如果不同的话,可以考虑用 putenv 设置 PATH。

@AmazingDaFaFa
Copy link
Author

可以检查一下 PHP 中 PATH 环境变量是什么,是否和 PHP 环境外相同。如果不同的话,可以考虑用 putenv 设置 PATH。

非常感谢,翻看源码后发现调用getenv返回值为空,在php配置中添加环境变量后解决!
现在运行ljudge时会提示
{ "compilation": { "log": "Cannot create temporary file in ./: Permission denied\n\nCompiler was killed by signal 6\n\n", "success": false } }
通过--debug并未发现明显问题。
strace -f中又出现了lrun require root 的情况,但是在debug中lrun有正常输出。
在其他issue中发现也许与ljudge和gcc版本有关,我用的是gcc-4.8.5,目前正在尝试使用旧版ljudge。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants