MyBB Community Forums

Full Version: opendir(./uploads/avatars): failed to open dir: No such file or directory
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
I am running 1.8.27 and am suddenly seeing the following error message:

Type: 2
File: inc/functions_upload.php (Line no. 173)
Message
opendir(./uploads/avatars): failed to open dir: No such file or directory
Back Trace: #0  errorHandler->email_error(2, opendir(./uploads/avatars): failed to open dir: No such file or directory, inc/functions_upload.php, 173) called at [/var/www/html/dv/inc/class_error.php:203]
#1  errorHandler->error(2, opendir(./uploads/avatars): failed to open dir: No such file or directory, inc/functions_upload.php, 173, Array ([uid] => 125,[exclude] => ,[mybb] => MyBB Object ([version] => 1.8.27,[version_code] => 1827,[cwd] => .,[input] => Array (),[cookies] => Array ([mybb] => Array ([lastvisit] => 1608477756,[lastactive] => 1608477808,[announcements] => 0),[loginattempts] => 1,[mybbuser] => ...,[sid] => 61208a4e619fdb7123c78a5736345d22),[user] => Array (),[usergroup] => Array (),[settings] => Array ([showownunapproved] => 0,

I currently have an 'uploads/avatars' directory structure in the root of the forum installation, with lots of older, pre-existing avatar files.  the user & group ownership is the same as the rest  of the forum, and i have not manually touched anyway.

any  ideas why its claiming the directory doesn't exist all of a sudden?

thanks.
If the user and group ownership are the same, are the permissions the same too? If the folder is there but PHP can't see it, it may not be readable.
(2021-07-04, 05:57 PM)Matt Wrote: [ -> ]If the user and group ownership are the same, are the permissions the same too? If the folder is there but PHP can't see it, it may not be readable.

permissions are the same. also, the pre-existing avatars load fine.
You may need to ask your host then. The error is coming from PHP and isn't specific to MyBB (this line of code hasn't changed in a decade), so if the folder definitely exists but PHP doesn't think it does, there isn't anything we can really do.
i am self hosting, and the only change was the recent upgrade to 1.8.27.
Well, this code hasn't changed for over a decade as I say, and PHP not being able to open a folder isn't something we can do much about.

Create a file called test.php in the root, and put this in it:

<?php
$dir = opendir('./uploads/avatars');
var_dump($dir);

Visit this in your browser, what does it output?
Its been a while, but this failed again. I tried the test.php, and it returns:

resource(3) of type (stream)
If it is just randomly failing then it suggests some sort of server or file system issue. If you’re still self hosting you’ll need to either seek advice from a server management forum, or host elsewhere.
I doubt its a file system issue. I run a number of other service, and this is the only one randomly failing to find files that exist.
Well, it can’t open a directory in the file system, so it’s more likely to be file system related than anything else. It’s literally a core PHP function trying to open a directory and it’s not able to, there’s nothing MyBB-specific about the error.
Pages: 1 2