-
Notifications
You must be signed in to change notification settings - Fork 36
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
Warning: exec(): Unable to fork #675
Comments
你试一下 shell_exec 是不是也不好使。 |
本项目应该是没有定义 PHP_WIN32 , 因为 windows cygwin 环境下构建,其实是类 linux 环境构建, 这是完整构建配置: https://github.com/swoole/swoole-cli/blob/main/sapi/scripts/cygwin/cygwin-config.sh windows 原生构建 ,定义 PHP_WIN32 所在文件: https://github.com/php/php-src/blob/php-8.1.27/win32/build/confutils.js#L3227
|
windows 构建配置在这个目录: https://github.com/php/php-src/tree/php-8.1.27/win32/build |
可定制一下编译参数试试,找到这个文件 https://github.com/swoole/swoole-cli/blob/main/sapi/scripts/cygwin/cygwin-config.sh 添加这一行 export CFLAGS="-DZEND_WIN32=1 "
|
看 VCWD_POPEN 函数的定义: 位于 https://github.com/swoole/swoole-cli/tree/main/Zend/zend_virtual_cwd.h 文件 |
可实验添加的参数 export CFLAGS="-DZEND_WIN32=1 -DPHP_WIN32=1 -DWIN32 "
|
@niceboyat 你试试 不添加 -f 执行,报错吗? |
我测试不添加-f也不行 |
辛苦了。 |
win10下cmd运行:
swoole-cli -f ./test.php
test.php文件代码:
<?php exec('dir', $str, $code); ?>
出现这个错误:
The text was updated successfully, but these errors were encountered: