warning:require_once (/mnt/hgfs/www/open/test/requests-master/ library/requests/exception.php): Failed to open stream:too many open files in/mnt/hgfs/www/open/test/requests-master/ library/requests.php on line 136PHP Fatal error:require_once (): Failed opening required '/mnt/hgfs/www/open/test/reques Ts-master/library/requests/exception.php ' (include_path= '.:/ Usr/local/php/lib/php ') in/mnt/hgfs/www/open/test/requests-master/library/requests.php on line 136Fatal error: Require_once (): Failed opening required '/mnt/hgfs/www/open/test/requests-master/library/requests/exception.php ' ( Include_path= '.:/ Usr/local/php/lib/php ') in/mnt/hgfs/www/open/test/requests-master/library/requests.php on line 136
// 从数据库取出一篇文章include '../Requests-master/Request.php';$article_cond='some cond';$article=$db->fetchByCond($article_cond)while($article){ $return=Request::post($url,$data,$header); // do others $article=$db->fetchByCond($article_cond);}
The following is an error in this file
public static function autoloader($class) { // Check that the class starts with "Requests" if (strpos($class, 'Requests') !== 0) { return; } $file = str_replace('_', '/', $class); if (file_exists(dirname(__FILE__) . '/' . $file . '.php')) { // 下面这行是136行 require_once(dirname(__FILE__) . '/' . $file . '.php'); } }
Remove the article from the database, and then use PHP requests the library to insert the article into the database on another server (this is all 127.0.0.1). Do not know what will appear this problem, each insert 1020 article will appear this problem, do not know where to set the problem?
Reply content:
warning:require_once (/mnt/hgfs/www/open/test/requests-master/ library/requests/exception.php): Failed to open stream:too many open files in/mnt/hgfs/www/open/test/requests-master/ library/requests.php on line 136PHP Fatal error:require_once (): Failed opening required '/mnt/hgfs/www/open/test/reques Ts-master/library/requests/exception.php ' (include_path= '.:/ Usr/local/php/lib/php ') in/mnt/hgfs/www/open/test/requests-master/library/requests.php on line 136Fatal error: Require_once (): Failed opening required '/mnt/hgfs/www/open/test/requests-master/library/requests/exception.php ' ( Include_path= '.:/ Usr/local/php/lib/php ') in/mnt/hgfs/www/open/test/requests-master/library/requests.php on line 136
// 从数据库取出一篇文章include '../Requests-master/Request.php';$article_cond='some cond';$article=$db->fetchByCond($article_cond)while($article){ $return=Request::post($url,$data,$header); // do others $article=$db->fetchByCond($article_cond);}
The following is an error in this file
public static function autoloader($class) { // Check that the class starts with "Requests" if (strpos($class, 'Requests') !== 0) { return; } $file = str_replace('_', '/', $class); if (file_exists(dirname(__FILE__) . '/' . $file . '.php')) { // 下面这行是136行 require_once(dirname(__FILE__) . '/' . $file . '.php'); } }
Remove the article from the database, and then use PHP requests the library to insert the article into the database on another server (this is all 127.0.0.1). Do not know what will appear this problem, each insert 1020 article will appear this problem, do not know where to set the problem?
Too Many open files, this hint is very clear, the development of too many files.
The number of files opened by a process is capped, cannot exceed this value, require_once is to open the file, so there is an error.
Back to your question, simple require should not reach the file open limit, two directions to check the problem it
-
Is there a problem with cyclic require?
-
Are there too many open files in other locations and no close?