mirror of
https://github.com/php/php-src.git
synced 2025-08-15 21:48:51 +02:00
Merge branch 'PHP-7.4'
* PHP-7.4: Add php_cli_server_connect() helper
This commit is contained in:
commit
b0d8f012f9
33 changed files with 83 additions and 251 deletions
|
@ -1,7 +1,7 @@
|
|||
<?php
|
||||
define ("PHP_CLI_SERVER_HOSTNAME", "localhost");
|
||||
define ("PHP_CLI_SERVER_PORT", 8964);
|
||||
define ("PHP_CLI_SERVER_ADDRESS", PHP_CLI_SERVER_HOSTNAME.":".PHP_CLI_SERVER_PORT);
|
||||
define("PHP_CLI_SERVER_HOSTNAME", "localhost");
|
||||
define("PHP_CLI_SERVER_PORT", 8964);
|
||||
define("PHP_CLI_SERVER_ADDRESS", PHP_CLI_SERVER_HOSTNAME.":".PHP_CLI_SERVER_PORT);
|
||||
|
||||
function php_cli_server_start(
|
||||
?string $code = 'echo "Hello world";',
|
||||
|
@ -96,4 +96,14 @@ php_cli_server_start_error:
|
|||
|
||||
return $handle;
|
||||
}
|
||||
|
||||
function php_cli_server_connect() {
|
||||
$timeout = 1.0;
|
||||
$fp = fsockopen(PHP_CLI_SERVER_HOSTNAME, PHP_CLI_SERVER_PORT, $errno, $errstr, $timeout);
|
||||
if (!$fp) {
|
||||
die("connect failed");
|
||||
}
|
||||
return $fp;
|
||||
}
|
||||
|
||||
?>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue