[php-src] Issue #7990: Build only php -S, passthru(), redirect to server from symlink
| From: | guest271314 | Date: | Sat, 22 Jan 2022 15:25:41 +0000 |
| Subject: | [php-src] Issue #7990: Build only php -S, passthru(), redirect to server from symlink | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-239223@lists.php.net to get a copy of this message | ||
Issue: https://github.com/php/php-src/issues/7990
Author: guest271314
### Description
I only require built-in local server
php -S localhost:8000 and passthru(),
not the remainder of PHP.
Additionally I need to make requests to the local server using a symbolic link.
Are the above two requirements possible?
```
<?php
header('Vary: Origin');
header("Access-Control-Allow-Origin: *");
header("Access-Control-Allow-Methods: GET");
header("Content-Type: application/octet-stream");
header("X-Powered-By:");
echo passthru("parec -d @DEFAULT_MONITOR@");
exit();
}
```
```
let abortable = new AbortController();
let {signal} = abortable;
// 'chrome-extension://xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx/test.txt'
// is symbolic link to http://localhost:8000
fetch('chrome-extension://xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx/test.txt', {signal})
.then((r) => r.body)
.then((readable) => readable.pipeTo(new WritableStream({
write(v) {console.log(v) // do stuff},
close() {console.log('Stream closed.')}
}))
.catch(console.warn);
```