[php-src] Issue #12138: PHP build in web server cant call itself via curl
| From: | danielstorch | Date: | Wed, 06 Sep 2023 09:54:39 +0000 |
| Subject: | [php-src] Issue #12138: PHP build in web server cant call itself via curl | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-245343@lists.php.net to get a copy of this message | ||
Issue: https://github.com/php/php-src/issues/12138
Author: danielstorch
### Description
Im not sure if this is a bug or something that is not intended to work or if im missing a
configuration. But im out of things to try..
I have a project, where the application is calling itself via curl. But with the build in web server
for development, this does currently not work. The curl requests to itself does never return and
also doesn't tell what the problem is.
With a server like Apache, this is not an issue and the applications works just fine (production).
**The following code**:
So basically i have two APIs:
http://127.0.0.1:9000/curl and http://127.0.0.1:9000/api
The **curl.php** calls the **api.php** like this:
```
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'http://127.0.0.1:9000/api')
$response = curl_exec($ch);
```
Here is an example application, which mimics the problem i have: https://github.com/danielstorch/phpTestApp/tree/main
**Resulted in this output:**
The call does never return and the server has to be terminated by a kill command. In this state, the
server is also blocked for any other request.
**But I expected this output instead:**
To return the API call.
Anyone knows why this does not work?
Thanks
### PHP Version
PHP 7.4.33
### Operating System
macOS Monterey 12.3.1