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

MAC M1芯片,用swoole-cli,CURL请求或者携程请求一直会报DNS超时 #5103

Open
fengyikang88 opened this issue Jul 22, 2023 · 7 comments

Comments

@fengyikang88
Copy link

DEBUG] Event Hyperf\FramTe0 getimagesize(https://st1o/ 1oroe6fla7d7314d.png[ERROR] ErrorException: getimagesize(r-r."hund /2820-03/16/16f5e6f77314d. mno): Failed to open stream: DS LookuD resolve timeout in /users/ fy/Desktop/w/cataboard _hyperf/app/comand/itmicomand.,pip:33Stack trace:dler\Listener{closure}(2,'getimagesize(ht...",'/users/fyk/Desk...', 33)#0 [internal function]: Hyperf Exception#1 /Users/fyk/Desktop/WWW/dataBoard_hyperf/app/Commo(33): getimagesize( https://static#2 /Users/fyk/Desktop/WWw/dataBoard_hyperf/ved.php(428): App\Command\HtmLCommand->handle()#3[internal function]: Hyperf\Command\Command->Hyperf\Command{closure}()#4 [main}
,用这个函数getimagesize或者其他带有curl请求都会报超时,自己编译的swoole版本没问题。

@matyhtf
Copy link
Member

matyhtf commented Jul 23, 2023

查看一下 /etc/resole.conf 配置,通过 nslookup 命令,查看是否可以正常解析

另外,请安装 issue 模版提供详细的版本信息

@fengyikang88
Copy link
Author

nslookup可以解析,但是用swoole-cli还是不行,用自己编译到本地swoole.so是可以的。用的版本是@MacBook server % swoole5 -v
Swoole 5.0.3 (cli) (built: May 9 2023 11:27:01) (NTS

@jingjingxyk
Copy link

执行如下命令,把结果截图,反馈到这里

otool -L  ./swoole-cli
file ./swoole-cli

@fengyikang88
Copy link
Author

image

swoole5 % otool -L ./swoole-cli
./swoole-cli:
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1292.100.5)
/usr/lib/libsasl2.2.dylib (compatibility version 3.0.0, current version 3.15.0)
/usr/lib/libresolv.9.dylib (compatibility version 1.0.0, current version 1.0.0)
/usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 905.6.0)
/usr/lib/libnetwork.dylib (compatibility version 1.0.0, current version 1.0.0)
fyk@MacBook swoole5 % file ./swoole-cli
./swoole-cli: Mach-O 64-bit executable arm64

@jingjingxyk
Copy link

jingjingxyk commented Jul 26, 2023

@fengyikang88
本地试试这个代码,看看是否也报错

<?php

\Co\run(function() {
    go(function () {
        $filename='https://www.swoole.com/dist/skin1/images/project-0.png';
        $size = getimagesize($filename);
        var_dump($size);
    });
});

getimagesize 函数用法:https://www.php.net/manual/zh/function.getimagesize.php

此函数要求 filename 是有效的图像文件。如果提供的是非图像,可能会错误的识别为图像且函数会成功返回,但数组可能包含无意义的值。

@fengyikang88
Copy link
Author

@fengyikang88 本地试试这个代码,看看是否也报错

<?php

\Co\run(function() {
    go(function () {
        $filename='https://www.swoole.com/dist/skin1/images/project-0.png';
        $size = getimagesize($filename);
        var_dump($size);
    });
});

getimagesize 函数用法:https://www.php.net/manual/zh/function.getimagesize.php

此函数要求 filename 是有效的图像文件。如果提供的是非图像,可能会错误的识别为图像且函数会成功返回,但数组可能包含无意义的值。

@MacBook Desktop % swoole5 index.php
Warning: getimagesize(https://www.swoole.com/dist/skin1/images/project-0.png): Failed to open stream: DNS Lookup resolve timeout in /Users/fyk/Desktop/index.php on line 6
bool(false)
还是不行报错,我的电脑是M1pro的芯片,macbook pro14寸的,就是用swoole-cli不行,自己编译swoole拓展到本地的php是没问题的。

@jingjingxyk
Copy link

@fengyikang88 ,我没有 M1pro 。

提议,你可以自己编译 swoole-cli , 看看自己编译出来的是否也有同样的错误

git clone -b main --recursive  https://github.com/swoole/swoole-cli.git 

cd swoole-cli
composer update 
php prepare.php
bash make.sh all-library
bash make.sh config 
bash make.sh build 

# 编译好
./bin/swoole-cli -v 
./bin/swoole-cli --ri swoole 

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

3 participants