Browse files

Tweaked release files, and regenerated package.xml.

  • Loading branch information...
1 parent c06ec7a commit ac4d5fe6b7fd1a25f9a45c4454a8e85462837370 @boenrobot boenrobot committed Nov 1, 2014
Showing with 240 additions and 217 deletions.
  1. +3 −2 .scrutinizer.yml
  2. +5 −3 .travis.yml
  3. +1 −0 RELEASE-1.0.0a5
  4. +1 −1 composer.json
  5. +78 −49 package.xml
  6. +128 −140 packagexmlsetup.php
  7. +24 −22 stub.php
View
5 .scrutinizer.yml
@@ -2,8 +2,9 @@ imports:
- php
inherit: true
tools:
- external_code_coverage:
- runs: 4
+ ##See .travis.yml.
+ #external_code_coverage:
+ # runs: 4
php_sim: false
php_cpd: true
php_code_sniffer:
View
8 .travis.yml
@@ -14,8 +14,10 @@ before_script:
- ../vendor/bin/phpunit --configuration secondaryPeer.xml > secondaryPeer.out.txt &
- sleep 2
script:
- - ../vendor/bin/phpunit --coverage-clover=coverage.clover --configuration phpunit.xml
- - wget https://scrutinizer-ci.com/ocular.phar
- - php ocular.phar code-coverage:upload --format=php-clover coverage.clover
+ - ../vendor/bin/phpunit --configuration phpunit.xml
+ ## Code coverage seems to be causing a failure currently.
+ #- ../vendor/bin/phpunit --coverage-clover=coverage.clover --configuration phpunit.xml
+ #- wget https://scrutinizer-ci.com/ocular.phar
+ #- php ocular.phar code-coverage:upload --format=php-clover coverage.clover
after_script:
- cat secondaryPeer.out.txt
View
1 RELEASE-1.0.0a5
@@ -1,3 +1,4 @@
* Added fragments to exceptions, allowing retrieval of incomplete receives' contents, and byte count on incomplete sends.
* Changed Stream to use an fread/fwrite duo instead of stream_copy_to_stream() for the sake of stability.
+* Tweaked Stream::isAcceptingData() and NetworkStream::isAvailable(), in order to work around a reproducible hang on Linux.
* Doc fixes.
View
2 composer.json
@@ -23,7 +23,7 @@
"phpunit/phpunit": "@stable"
},
"suggest": {
- "pear2/cache_shm": ">=0.1.2",
+ "pear2/cache_shm": ">=0.1.3",
"ext-apc": ">=3.0.13",
"ext-wincache": ">=1.1.0",
"ext-openssl": "*"
View
127 package.xml
@@ -2,8 +2,7 @@
<package version="2.1" xmlns="http://pear.php.net/dtd/package-2.1" xmlns:tasks="http://pear.php.net/dtd/tasks-1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://pear.php.net/dtd/tasks-1.0 http://pear.php.net/dtd/tasks-1.0.xsd http://pear.php.net/dtd/package-2.1 http://pear.php.net/dtd/package-2.1.xsd">
<name>PEAR2_Net_Transmitter</name>
<channel>pear2.php.net</channel>
- <summary>Wrapper for network stream functionality.
-</summary>
+ <summary>Wrapper for network stream functionality.</summary>
<description>PHP has built in support for various types of network streams, such as HTTP and TCP sockets. One problem that arises with them is the fact that a single fread/fwrite call might not read/write all the data you intended, regardless of whether you're in blocking mode or not. While the PHP manual offers a workaround in the form of a loop with a few variables, using it every single time you want to read/write can be tedious.
This package abstracts this away, so that when you want to get exactly N amount of bytes, you can be sure the upper levels of your app will be dealing with N bytes. Oh, and the functionality is nicely wrapped in an object (but that's just the icing on the cake).</description>
@@ -13,99 +12,106 @@ This package abstracts this away, so that when you want to get exactly N amount
<email>boen.robot@gmail.com</email>
<active>yes</active>
</lead>
- <date>2013-08-15</date>
- <time>18:20:49</time>
+ <date>2014-11-02</date>
+ <time>07:03:22</time>
<version>
- <release>1.0.0a4</release>
+ <release>1.0.0a5</release>
<api>1.0.0</api>
</version>
<stability>
<release>alpha</release>
<api>alpha</api>
</stability>
<license uri="http://www.gnu.org/copyleft/lesser.html">LGPL License 2.1</license>
- <notes>* Support for encrypted connections. Note that due to known issues with PHP itself, encrypted connections may be unstable (as in &quot;sometimes disconnect suddenly&quot; or &quot;sometimes hang when calling TcpClient::isDataAwaiting() without a timeout&quot;).
-* Stream::isAcceptingData() and Stream::isDataAwaiting() now accept an optional timeout, modeled after stream_select().
-* Changed sending to retry indefinetly unless the connection is broken, thanks to isDataAwaiting()'s new ability. Receiving can still timeout.
-* Chnaged the PHAR stub to not fail when reading the hash fails.
-* Doc and CS fixes.</notes>
+ <notes>* Added fragments to exceptions, allowing retrieval of incomplete receives' contents, and byte count on incomplete sends.
+* Changed Stream to use an fread/fwrite duo instead of stream_copy_to_stream() for the sake of stability.
+* Tweaked Stream::isAcceptingData() and NetworkStream::isAvailable(), in order to work around a reproducible hang on Linux.
+* Doc fixes.</notes>
<contents>
<dir name="/">
<dir name="docs" baseinstalldir="/">
<file role="doc" name="apigen.neon">
- <tasks:replace from="../src" to="php_dir" type="pear-config"/>
+ <tasks:replace type="pear-config" to="php_dir" from="../src"/>
</file>
<file role="doc" name="doxygen.ini">
- <tasks:replace from="../src" to="php_dir" type="pear-config"/>
- <tasks:replace from="GIT: $Id$" to="version" type="package-info"/>
+ <tasks:replace type="pear-config" to="php_dir" from="../src"/>
+ <tasks:replace type="package-info" to="version" from="GIT: $Id$"/>
</file>
<file role="doc" name="phpdoc.dist.xml">
- <tasks:replace from="../src" to="php_dir" type="pear-config"/>
+ <tasks:replace type="pear-config" to="php_dir" from="../src"/>
</file>
</dir>
<dir name="src" baseinstalldir="/">
<dir name="PEAR2">
<dir name="Net">
<dir name="Transmitter">
<file role="php" name="Exception.php">
- <tasks:replace from="~~summary~~" to="summary" type="package-info"/>
- <tasks:replace from="~~description~~" to="description" type="package-info"/>
- <tasks:replace from="GIT: $Id$" to="version" type="package-info"/>
+ <tasks:replace type="package-info" to="version" from="GIT: $Id$"/>
+ <tasks:replace type="package-info" to="summary" from="~~summary~~"/>
+ <tasks:replace type="package-info" to="description" from="~~description~~"/>
</file>
<file role="php" name="FilterCollection.php">
- <tasks:replace from="~~summary~~" to="summary" type="package-info"/>
- <tasks:replace from="~~description~~" to="description" type="package-info"/>
- <tasks:replace from="GIT: $Id$" to="version" type="package-info"/>
+ <tasks:replace type="package-info" to="version" from="GIT: $Id$"/>
+ <tasks:replace type="package-info" to="summary" from="~~summary~~"/>
+ <tasks:replace type="package-info" to="description" from="~~description~~"/>
</file>
<file role="php" name="LockException.php">
- <tasks:replace from="~~summary~~" to="summary" type="package-info"/>
- <tasks:replace from="~~description~~" to="description" type="package-info"/>
- <tasks:replace from="GIT: $Id$" to="version" type="package-info"/>
+ <tasks:replace type="package-info" to="version" from="GIT: $Id$"/>
+ <tasks:replace type="package-info" to="summary" from="~~summary~~"/>
+ <tasks:replace type="package-info" to="description" from="~~description~~"/>
</file>
<file role="php" name="NetworkStream.php">
- <tasks:replace from="~~summary~~" to="summary" type="package-info"/>
- <tasks:replace from="~~description~~" to="description" type="package-info"/>
- <tasks:replace from="GIT: $Id$" to="version" type="package-info"/>
+ <tasks:replace type="package-info" to="version" from="GIT: $Id$"/>
+ <tasks:replace type="package-info" to="summary" from="~~summary~~"/>
+ <tasks:replace type="package-info" to="description" from="~~description~~"/>
</file>
<file role="php" name="SocketException.php">
- <tasks:replace from="~~summary~~" to="summary" type="package-info"/>
- <tasks:replace from="~~description~~" to="description" type="package-info"/>
- <tasks:replace from="GIT: $Id$" to="version" type="package-info"/>
+ <tasks:replace type="package-info" to="version" from="GIT: $Id$"/>
+ <tasks:replace type="package-info" to="summary" from="~~summary~~"/>
+ <tasks:replace type="package-info" to="description" from="~~description~~"/>
</file>
<file role="php" name="Stream.php">
- <tasks:replace from="~~summary~~" to="summary" type="package-info"/>
- <tasks:replace from="~~description~~" to="description" type="package-info"/>
- <tasks:replace from="GIT: $Id$" to="version" type="package-info"/>
+ <tasks:replace type="package-info" to="version" from="GIT: $Id$"/>
+ <tasks:replace type="package-info" to="summary" from="~~summary~~"/>
+ <tasks:replace type="package-info" to="description" from="~~description~~"/>
</file>
<file role="php" name="StreamException.php">
- <tasks:replace from="~~summary~~" to="summary" type="package-info"/>
- <tasks:replace from="~~description~~" to="description" type="package-info"/>
- <tasks:replace from="GIT: $Id$" to="version" type="package-info"/>
+ <tasks:replace type="package-info" to="version" from="GIT: $Id$"/>
+ <tasks:replace type="package-info" to="summary" from="~~summary~~"/>
+ <tasks:replace type="package-info" to="description" from="~~description~~"/>
</file>
<file role="php" name="TcpClient.php">
- <tasks:replace from="~~summary~~" to="summary" type="package-info"/>
- <tasks:replace from="~~description~~" to="description" type="package-info"/>
- <tasks:replace from="GIT: $Id$" to="version" type="package-info"/>
+ <tasks:replace type="package-info" to="version" from="GIT: $Id$"/>
+ <tasks:replace type="package-info" to="summary" from="~~summary~~"/>
+ <tasks:replace type="package-info" to="description" from="~~description~~"/>
</file>
<file role="php" name="TcpServerConnection.php">
- <tasks:replace from="~~summary~~" to="summary" type="package-info"/>
- <tasks:replace from="~~description~~" to="description" type="package-info"/>
- <tasks:replace from="GIT: $Id$" to="version" type="package-info"/>
+ <tasks:replace type="package-info" to="version" from="GIT: $Id$"/>
+ <tasks:replace type="package-info" to="summary" from="~~summary~~"/>
+ <tasks:replace type="package-info" to="description" from="~~description~~"/>
</file>
</dir>
</dir>
</dir>
</dir>
<dir name="tests" baseinstalldir="/">
<file role="test" name="bootstrap.php">
- <tasks:replace from="../src" to="php_dir" type="pear-config"/>
+ <tasks:replace type="pear-config" to="php_dir" from="../src"/>
+ <tasks:replace type="package-info" to="version" from="GIT: $Id$"/>
</file>
- <file role="test" name="ClientEncryptedTest.php_"/>
+ <file role="test" name="ClientEncryptedTest.php"/>
<file role="test" name="ClientTest.php"/>
- <file role="test" name="phpunit.xml"/>
- <file role="test" name="secondaryPeer.bat"/>
- <file role="test" name="secondaryPeer.xml"/>
- <file role="test" name="ServerEncryptedTest.php_"/>
+ <file role="test" name="phpunit.xml">
+ <tasks:replace type="pear-config" to="php_dir" from="../src"/>
+ </file>
+ <file role="test" name="secondaryPeer.bat">
+ <tasks:windowseol/>
+ </file>
+ <file role="test" name="secondaryPeer.xml">
+ <tasks:replace type="pear-config" to="php_dir" from="../src"/>
+ </file>
+ <file role="test" name="selfSigned.cer"/>
+ <file role="test" name="ServerEncryptedTest.php"/>
<file role="test" name="ServerTest.php"/>
<file role="test" name="UnconnectedTest.php"/>
</dir>
@@ -129,14 +135,37 @@ This package abstracts this away, so that when you want to get exactly N amount
<package>
<name>PEAR2_Cache_SHM</name>
<channel>pear2.php.net</channel>
- <min>0.1.2</min>
+ <min>0.1.3</min>
</package>
<extension>
<name>openssl</name>
</extension>
</optional>
</dependencies>
<phprelease>
- <filelist></filelist>
+ <filelist>
+ <install name="docs/apigen.neon" as="apigen.neon"/>
+ <install name="docs/doxygen.ini" as="doxygen.ini"/>
+ <install name="docs/phpdoc.dist.xml" as="phpdoc.dist.xml"/>
+ <install name="src/PEAR2/Net/Transmitter/Exception.php" as="PEAR2/Net/Transmitter/Exception.php"/>
+ <install name="src/PEAR2/Net/Transmitter/FilterCollection.php" as="PEAR2/Net/Transmitter/FilterCollection.php"/>
+ <install name="src/PEAR2/Net/Transmitter/LockException.php" as="PEAR2/Net/Transmitter/LockException.php"/>
+ <install name="src/PEAR2/Net/Transmitter/NetworkStream.php" as="PEAR2/Net/Transmitter/NetworkStream.php"/>
+ <install name="src/PEAR2/Net/Transmitter/SocketException.php" as="PEAR2/Net/Transmitter/SocketException.php"/>
+ <install name="src/PEAR2/Net/Transmitter/Stream.php" as="PEAR2/Net/Transmitter/Stream.php"/>
+ <install name="src/PEAR2/Net/Transmitter/StreamException.php" as="PEAR2/Net/Transmitter/StreamException.php"/>
+ <install name="src/PEAR2/Net/Transmitter/TcpClient.php" as="PEAR2/Net/Transmitter/TcpClient.php"/>
+ <install name="src/PEAR2/Net/Transmitter/TcpServerConnection.php" as="PEAR2/Net/Transmitter/TcpServerConnection.php"/>
+ <install name="tests/bootstrap.php" as="bootstrap.php"/>
+ <install name="tests/ClientEncryptedTest.php" as="ClientEncryptedTest.php"/>
+ <install name="tests/ClientTest.php" as="ClientTest.php"/>
+ <install name="tests/phpunit.xml" as="phpunit.xml"/>
+ <install name="tests/secondaryPeer.bat" as="secondaryPeer.bat"/>
+ <install name="tests/secondaryPeer.xml" as="secondaryPeer.xml"/>
+ <install name="tests/selfSigned.cer" as="selfSigned.cer"/>
+ <install name="tests/ServerEncryptedTest.php" as="ServerEncryptedTest.php"/>
+ <install name="tests/ServerTest.php" as="ServerTest.php"/>
+ <install name="tests/UnconnectedTest.php" as="UnconnectedTest.php"/>
+ </filelist>
</phprelease>
</package>
View
268 packagexmlsetup.php
@@ -14,170 +14,158 @@
* @link http://pear2.php.net/PEAR2_Net_Transmitter
*/
+/**
+ * References the package in $package and/or $compatible.
+ */
use Pyrus\Developer\PackageFile\v2;
+/**
+ * Configuration array.
+ *
+ * Each key is the task.
+ *
+ * The task "replace" uses an array where the key is the value to be searched
+ * for, and the value is an array of additional attributes for the task, which
+ * normally contain at least "type" (pear-config/package-info) and "to", which
+ * specifies the value to replace it with.
+ *
+ * The task "eol" uses an array where the key is a filename pattern to be
+ * matched, and the value is the target platform's EOL to be used for those
+ * file names (windows/unix).
+ *
+ * Unrecognized tasks are ignored.
+ *
+ * @var array
+ */
+$config = array(
+ 'replace' => array(
+ '../src' => array(
+ 'type' => 'pear-config',
+ 'to' => 'php_dir'
+ ),
+ 'GIT: $Id$' => array(
+ 'type' => 'package-info',
+ 'to' => 'version'
+ ),
+ '~~summary~~' => array(
+ 'type' => 'package-info',
+ 'to' => 'summary'
+ ),
+ '~~description~~' => array(
+ 'type' => 'package-info',
+ 'to' => 'description'
+ )
+ ),
+ 'eol' => array(
+ '*.bat' => 'windows'
+ )
+);
+
+if (!isset($package)) {
+ die('This file must be executed via "pyrus.phar make".');
+}
+
$packageGen = function (
+ array $config,
v2 $package,
v2 $compatible = null
) {
- $srcDirTask = array(
- 'tasks:replace' => array(
- array(
- 'attribs' => array(
- 'from' => '../src',
- 'to' => 'php_dir',
- 'type' => 'pear-config'
- )
- )
- )
- );
-
- $srcFileTasks = array(
- 'tasks:replace' => array(
- array(
- 'attribs' => array(
- 'from' => '~~summary~~',
- 'to' => 'summary',
- 'type' => 'package-info'
- )
- ),
- array(
- 'attribs' => array(
- 'from' => '~~description~~',
- 'to' => 'description',
- 'type' => 'package-info'
- )
- ),
- array(
- 'attribs' => array(
- 'from' => 'GIT: $Id$',
- 'to' => 'version',
- 'type' => 'package-info'
- )
- )
- )
- );
-
- $package->files['tests/bootstrap.php'] = array_merge_recursive(
- $package->files['tests/bootstrap.php']->getArrayCopy(),
- $srcDirTask
- );
-
- $package->files['docs/phpdoc.dist.xml'] = array_merge_recursive(
- $package->files['docs/phpdoc.dist.xml']->getArrayCopy(),
- $srcDirTask
- );
- $package->files['docs/apigen.neon'] = array_merge_recursive(
- $package->files['docs/apigen.neon']->getArrayCopy(),
- $srcDirTask
- );
-
- $package->files['docs/doxygen.ini'] = array_merge_recursive(
- $package->files['docs/doxygen.ini']->getArrayCopy(),
- $srcDirTask,
- array(
- 'tasks:replace' => array(
- array(
- 'attribs' => array(
- 'from' => 'GIT: $Id$',
- 'to' => 'version',
- 'type' => 'package-info'
- )
- )
- )
- )
- );
- $hasCompatible = null !== $compatible;
- if ($hasCompatible) {
- $compatible->license = $package->license;
- $compatible->files[
- "test/{$package->channel}/{$package->name}/bootstrap.php"
- ] = array_merge_recursive(
- $compatible->files[
- "test/{$package->channel}/{$package->name}/bootstrap.php"
- ]->getArrayCopy(),
- $srcDirTask
- );
-
- $compatible->files[
- "doc/{$package->channel}/{$package->name}/phpdoc.dist.xml"
- ] = array_merge_recursive(
- $compatible->files[
- "doc/{$package->channel}/{$package->name}/phpdoc.dist.xml"
- ]->getArrayCopy(),
- $srcDirTask
- );
- $compatible->files["doc/{$package->channel}/{$package->name}/doxygen.ini"]
- = array_merge_recursive(
- $compatible->files[
- "doc/{$package->channel}/{$package->name}/doxygen.ini"
- ]->getArrayCopy(),
- $srcDirTask,
- array(
- 'tasks:replace' => array(
- array(
- 'attribs' => array(
- 'from' => 'GIT: $Id$',
- 'to' => 'version',
- 'type' => 'package-info'
- )
- )
- )
- )
- );
- }
+ $tasksNs = $package->getTasksNs();
+ $cTasksNs = $compatible ? $compatible->getTasksNs() : '';
$oldCwd = getcwd();
chdir(__DIR__);
- foreach (
- new RecursiveIteratorIterator(
- new RecursiveDirectoryIterator(
- 'src',
- RecursiveDirectoryIterator::UNIX_PATHS
- | RecursiveDirectoryIterator::SKIP_DOTS
- ),
- RecursiveIteratorIterator::LEAVES_ONLY
- ) as $path) {
- $filename = $path->getPathname();
-
- $package->files[$filename] = array_merge_recursive(
- $package->files[$filename]->getArrayCopy(),
- $srcFileTasks
- );
-
- if ($hasCompatible) {
- $compatibleFilename = str_replace('src/', 'php/', $filename);
- $compatible->files[$compatibleFilename] = array_merge_recursive(
- $compatible->files[$compatibleFilename]->getArrayCopy(),
- $srcFileTasks
- );
- }
- }
-
- foreach (
- new RecursiveIteratorIterator(
- new RecursiveDirectoryIterator(
- '.',
- RecursiveDirectoryIterator::UNIX_PATHS
- | RecursiveDirectoryIterator::SKIP_DOTS
- ),
- RecursiveIteratorIterator::LEAVES_ONLY
- ) as $path) {
+ foreach (new RecursiveIteratorIterator(
+ new RecursiveDirectoryIterator(
+ '.',
+ RecursiveDirectoryIterator::UNIX_PATHS
+ | RecursiveDirectoryIterator::SKIP_DOTS
+ ),
+ RecursiveIteratorIterator::LEAVES_ONLY
+ ) as $path) {
$filename = substr($path->getPathname(), 2);
+ $cFilename = str_replace('src/', 'php/', $filename);
if (isset($package->files[$filename])) {
+ $parsedFilename = pathinfo($filename);
$as = (strpos($filename, 'examples/') === 0)
? $filename
: substr($filename, strpos($filename, '/') + 1);
+ if (strpos($filename, 'scripts/') === 0) {
+ if (isset($parsedFilename['extension'])
+ && 'php' === $parsedFilename['extension']
+ && !is_file(
+ $parsedFilename['dirname'] . '/' .
+ $parsedFilename['filename']
+ )
+ && is_file(
+ $parsedFilename['dirname'] . '/' .
+ $parsedFilename['filename'] . '.bat'
+ )
+ ) {
+ $as = substr($as, 0, -4);
+ }
+ }
$package->getReleaseToInstall('php')->installAs($filename, $as);
+
+ $contents = file_get_contents($filename);
+ foreach ($config['replace'] as $from => $attribs) {
+ if (strpos($contents, $from) !== false) {
+ $attribs['from'] = $from;
+ $package->files[$filename] = array_merge_recursive(
+ $package->files[$filename]->getArrayCopy(),
+ array(
+ "{$tasksNs}:replace" => array(
+ array(
+ 'attribs' => $attribs
+ )
+ )
+ )
+ );
+
+ if ($compatible) {
+ $compatible->files[$cFilename] = array_merge_recursive(
+ $compatible->files[$cFilename]->getArrayCopy(),
+ array(
+ "{$cTasksNs}:replace" => array(
+ array(
+ 'attribs' => $attribs
+ )
+ )
+ )
+ );
+ }
+ }
+ }
+
+ foreach ($config['eol'] as $pattern => $platform) {
+ if (fnmatch($pattern, $filename)) {
+ $package->files[$filename] = array_merge_recursive(
+ $package->files[$filename]->getArrayCopy(),
+ array(
+ "{$tasksNs}:{$platform}eol" => array()
+ )
+ );
+
+ if ($compatible) {
+ $compatible->files[$cFilename] = array_merge_recursive(
+ $compatible->files[$cFilename]->getArrayCopy(),
+ array(
+ "{$cTasksNs}:{$platform}eol" => array()
+ )
+ );
+ }
+ }
+ }
}
}
chdir($oldCwd);
return array($package, $compatible);
};
list($package, $compatible) = $packageGen(
+ $config,
$package,
isset($compatible) ? $compatible : null
);
View
46 stub.php
@@ -70,7 +70,7 @@
} else {
echo <<<HEREDOC
WARNING: The OpenSSL extension is not loaded.
-You can't make encrypted connections without it.
+ You can't make encrypted connections without it.
HEREDOC;
}
@@ -81,31 +81,33 @@
The stream_socket_client() function is enabled.
If you can't connect to a host, this means one of the following:
-1. You've mistyped the IP and/or port. Check the IP and port you've specified
-are the ones you intended.
-
-2. The host is not reachable from your web server. Try to reach the host
-(!!!)from the web server(!!!) by other means (e.g. ping) using the same IP, and
-if you're unable to reach it, check the network settings on your web server,
-the remote host (if it's under your control) as well as any intermidiate nodes
-under your control that may affect the connection (e.g. routers, etc.).
-
-3. Your web server is configured to forbid that outgoing connection. If you're
-the web server administrator, check your firewall's settings. If you're on a
-hosting plan... Typically, shared hosts block all outgoing connections, but
-it's also possible that only connections to that port are blocked. If the
-remote host is under your control, try to connect to it on a popular port (21,
-80, 443, etc.), and if successful, keep using that port instead. If the
-connection fails even then, or if the remote host is not under your control,
-ask your host to configure their firewall so as to allow you to make outgoing
-connections to the ip:port you need to connect to.
+1. You've mistyped the IP and/or port.
+ Check the IP and port you've specified are the ones you intended.
+
+2. The host is not reachable from your web server.
+ Try to reach the host (!!!)from the web server(!!!) by other means
+ (e.g. ping) using the same IP, and if you're unable to reach it,
+ check the network settings on your web server, the remote host
+ (if it's under your control) as well as any intermidiate nodes under your
+ control that may affect the connection (e.g. routers, etc.).
+
+3. Your web server is configured to forbid that outgoing connection.
+ If you're the web server administrator, check your firewall's settings.
+ If you're on a hosting plan... Typically, shared hosts block all
+ outgoing connections, but it's also possible that only connections
+ to that port are blocked. If the remote host is under your control,
+ try to connect to it on a popular port (21, 80, 443, etc.),
+ and if successful, keep using that port instead. If the connection fails
+ even then, or if the remote host is not under your control, ask your host to
+ configure their firewall so as to allow you to make outgoing connections
+ to the ip:port you need to connect to.
HEREDOC;
} else {
echo <<<HEREDOC
-WARNING: stream_socket_client() is disabled. Without it, you won't be able to
-connect to any host. Enable it in php.ini, or ask your host to enable it for
-you.
+WARNING: stream_socket_client() is disabled.
+ Without it, you won't be able to connect to any host.
+ Enable it in php.ini, or ask your host to enable it for you.
HEREDOC;
}

0 comments on commit ac4d5fe

Please sign in to comment.