|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2018-01-12 23:08 UTC] a at b dot c dot de
[2018-01-15 10:31 UTC] imdad at neotericuk dot co dot uk
[2021-02-03 12:37 UTC] cmb@php.net
-Status: Open
+Status: Wont fix
-Assigned To:
+Assigned To: cmb
[2021-02-03 12:37 UTC] cmb@php.net
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Tue Oct 28 08:00:01 2025 UTC |
Description: ------------ Here is my PHP version $ php -v PHP 7.1.12 (cli) (built: Jan 10 2018 13:11:41) ( ZTS ) Copyright (c) 1997-2017 The PHP Group Zend Engine v3.1.0, Copyright (c) 1998-2017 Zend Technologies Here is the output if I grep the info $ php -i | grep -i thread System => Linux pthread 4.4.0-104-generic #127-Ubuntu SMP Mon Dec 11 12:16:42 UTC 2017 x86_64 Configure Command => './configure' '--prefix=/usr/local/php71/' '--with-pear' '--disable-short-tags' '--with-openssl' '--with-pcre-regex' '--with-zlib' '--enable-bcmath' '--with-curl' '--enable-exif' '--with-gettext' '--enable-intl' '--enable-mbstring' '--with-mysqli' '--enable-pdo' '--with-pdo-mysql' '--enable-soap' '--enable-simplexml' '--enable-xml' '--with-xmlrpc' '--with-xsl' '--enable-zip' '--enable-mysqlnd' '--enable-maintainer-zts' '--with-pthreads' Thread Safety => enabled But, when I run a PHP script from command line that has used Threads I get the below fatal error. Fatal error: Class 'Thread' not found in /home/<my folder path>/test1.php on line 2 Test script: --------------- <?php $task = new class extends Thread { private $response; function run() { $content = file_get_contents("http://google.com"); preg_match("~<title>(.+)</title>~", $content, $matches); $this->response = $matches[1]; } }; $task->start() && $task->join(); var_dump($task->response); // string(6) "Google" Expected result: ---------------- string(6) "Google" Actual result: -------------- Fatal error: Class 'Thread' not found in /home/<my folder path>/test1.php on line 2