My local environment is lnmp. Now I have two sites www.aa.com, and the other is api.aa.com, which mainly provides api interfaces. Now I want the site www.aa.com to call the api.aa.com interface. I called it in php curl mode, but I keep prompting that www.aa.com is being loaded. If my local environment is lnmp
Now there are two sites www.aa.com, and the other is api.aa.com, which mainly provides api interfaces.
I want to call the api.aa.com interface at www.aa.com. I called it in php curl mode.
But I keep prompting that www.aa.com is loading. If I set the timeout time to 1 s, it is OK, which means that I cannot get the returned value under the domain name api.aa.com.
If I change all the local environments to apache, the above problems will not occur ...... I will not encounter this problem in the pre-release test environment...
Preliminary conjecture: Is there a php process in nginx that has been suspended? I am a Windows development environment and it is not convenient to look at other processes, so please advise this problem solution 3q
Reply content:
My local environment is lnmp
Now there are two sites www.aa.com, and the other is api.aa.com, which mainly provides api interfaces.
I want to call the api.aa.com interface at www.aa.com. I called it in php curl mode.
But I keep prompting that www.aa.com is loading. If I set the timeout time to 1 s, it is OK, which means that I cannot get the returned value under the domain name api.aa.com.
If I change all the local environments to apache, the above problems will not occur ...... I will not encounter this problem in the pre-release test environment...
Preliminary conjecture: Is there a php process in nginx that has been suspended? I am a Windows development environment and it is not convenient to look at other processes, so please advise this problem solution 3q
To solve this problem, you can use httping locally to test the api.aa.com time. If the performance test is not performed, you can use php to call get_content_file. Print the timestamp before and after
If api.aa.com is slow, test the echo Statement on the simple index. php page. If the test fails, it is basically a server configuration problem.
If the call is successful, find the api.aa.com database call information, make simple data calls, and then perform business testing.
In addition, do not suspect that the problem is curl or nginx. If you have to doubt it, perform the test. Pay attention to the test method. Nginx supports concurrent operations, unless your concurrency is set too small, or the number of files opened in linux is too small. Curl itself is a php module, not part of the php kernel. It is a php-hosted process.
Check whether the domain name resolution problem exists.
Try to create a host.
Change/etc/hosts
127.0.0.1 api.aa.com
Today, I tried to run the code to the test environment. The OK test environment is also nginx. The cause of the error is that the local environment win is not php-fpm, and the local environment switches to apache. Everything is OK.