时间:2021-07-01 10:21:17 帮助过:6人阅读
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 136
PHP Fatal 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
Fatal 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);
}
下面的是出错的这个文件
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');
}
}
从数据库取出文章,然后用PHP Requests这个库将文章插入另一个服务器上的数据库(这里都是127.0.0.1)。不知道什么会出现这个问题,每插入1020篇文章就会出现这个问题,不知道是哪里设置的问题呢?
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 136
PHP Fatal 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
Fatal 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);
}
下面的是出错的这个文件
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');
}
}
从数据库取出文章,然后用PHP Requests这个库将文章插入另一个服务器上的数据库(这里都是127.0.0.1)。不知道什么会出现这个问题,每插入1020篇文章就会出现这个问题,不知道是哪里设置的问题呢?
Too many open files,这个提示说的很明白了,开发的文件太多了。
一个进程打开的文件数目是有上限的,无法超过这个值,require_once是要打开文件的,所以就出错了。
回到你的问题,单纯require是不应该达到文件打开上限的,两个方向来查问题吧
是否存在循环require的问题?
是否在其他位置open文件太多并且没有close?