[SOLVED] Warning if creating more than 4 subdirs

For questions and problems with the CMS core. This board is NOT for any 3rd party modules, addons, PHP scripts or anything NOT distributed with the CMS made simple package itself.
Post Reply
klenkes
Power Poster
Power Poster
Posts: 307
Joined: Mon Sep 08, 2008 9:43 am

[SOLVED] Warning if creating more than 4 subdirs

Post by klenkes »

Hi there.

I get a the following warning message in filemanager if I create more than 4 subdirs in /uploads

Code: Select all

Warning: opendir(/home/netsh100128/html/cmsmstest/uploads/images/layout/testdir/testagain/) [function.opendir]: failed to open dir: Too many open files in /home/netsh100128/html/cmsmstest/lib/misc.functions.php on line 944
Current path: /uploads/images/layout/testdir
Everything is fine if there are only 4 subdirs, like /uploads/images/layout/testdir
but as soon as I create the 5th dir (/uploads/images/layout/testdir/testagain/) the warning shows up.
The moment I delete the 5th and last dir, the warning disappears.

Don't get me wrong, it's only a warning and everything works like a charm(upload files, delete files...), but the warnings are piling up as create a hierarchy for photoalbums or something else.

It's CMSms 1.4.1, album 0.9.3 cataloger 0.7,  directory permissions are set to 755, and as I said before everything works fine except that the warning appears.

The installation runs on a subdomain but this cannot be the problem(?), but right now I don't have a domain left to test on a TLD, so I tested  a different testinstallation on another subdomain but the same warning appears.

Any ideas?
Last edited by klenkes on Thu Oct 23, 2008 5:47 pm, edited 1 time in total.
Pierre M.

Re: Warning if creating more than 4 subdirs

Post by Pierre M. »

Isn't it a PHP restriction ? Need to ask your hosting provider ?

Pierre
klenkes
Power Poster
Power Poster
Posts: 307
Joined: Mon Sep 08, 2008 9:43 am

Re: Warning if creating more than 4 subdirs

Post by klenkes »

Pierre M. wrote: Isn't it a PHP restriction ? Need to ask your hosting provider ?

Pierre
You think so...? I have never heard of it.
I will write an email to their support tomorrow. They usually anwers very quick.

Thanks for the hint.

--
Bernd
Connie

Re: Warning if creating more than 4 subdirs

Post by Connie »

no.. that should be just a rumour...

nobody should stop you to create as deep directory-structures as you want....

I can't believe that... must be other reason..
nhaack

Re: Warning if creating more than 4 subdirs

Post by nhaack »

mhh... the error says there are too many open files... I would say something is not closing files as it should, but to be honest I have no clue what could cause it. I checked it on a fresh install and could create down to the tenth level (I stopped then).

What other modules do you have installed? Any own plug-ins? Probably attached to system-hooks? Did you modify the file in question (or any core files)? Let's try to nail it down to the source... ;)

Best
Nils
klenkes
Power Poster
Power Poster
Posts: 307
Joined: Mon Sep 08, 2008 9:43 am

Re: Warning if creating more than 4 subdirs

Post by klenkes »

Thanks to the insight.
I wrote an email to my providers support. Maybe they know something about it.
In the meantime I do a fresh testinstall in a subdirectory of a toplevel domain and install nothing else but CMSms without any modules.

To Nils: another install shows the same behaviour! Modules are Album, Formbuilder, EditArea. Nothing unusual. No selfwritten plugins or changed code anywhere.

The thing is, that CMSms runs absolutely perfect, easy to upload via FTP and installs without any trouble or any other warnings. No trouble with permissions or anything.

I also run a Joomla installation and as soon I get the time I will test to create my subdirs there and look what happens.

I report what I find out.
klenkes
Power Poster
Power Poster
Posts: 307
Joined: Mon Sep 08, 2008 9:43 am

Re: Warning if creating more than 4 subdirs

Post by klenkes »

Well... I got 2 news about the subject.

1. My provider tells me that PHP ist restricted to 20 open files at the same time.
mhh... what does it mean? 20 files? A lot or not? That is the question?

2. Joomla 1.5 produces the same warning on same webspace! Now it's getting interesting!

My PHP skills are pretty limited when it comes to filehandling, so I post the corresponding codefunction. Perhaps someone may see something.

This is from CMSms /lib/misc.functions.php  line 931 to 963

Code: Select all

/**
 * Return an array containing a list of files in a directory
 * performs a recursive serach
 * @param  path      start path
 * @param  maxdepth  how deep to browse (-1=unlimited)
 * @param  mode      "FULL"|"DIRS"|"FILES"
 * @param  d         for internal use only
**/

function get_recursive_file_list ( $path , $excludes, $maxdepth = -1 , $mode = "FULL" , $d = 0 )
{
   if ( substr ( $path , strlen ( $path ) - 1 ) != '/' ) { $path .= '/' ; }     
   $dirlist = array () ;
   if ( $mode != "FILES" ) { $dirlist[] = $path ; }
     if ( $handle = opendir ( $path ) )  //<-- line 944 warning line ##############################
   {
       while ( false !== ( $file = readdir ( $handle ) ) )
       {
     if( $file == '.' || $file == '..' ) continue;
     if( filespec_is_excluded( $file, $excludes ) ) continue;

     $file = $path . $file ;
     if ( ! @is_dir ( $file ) ) { if ( $mode != "DIRS" ) { $dirlist[] = $file ; } }
     elseif ( $d >=0 && ($d < $maxdepth || $maxdepth < 0) )
       {
         $result = get_recursive_file_list ( $file . '/' , $excludes, $maxdepth , $mode , $d + 1 ) ;
         $dirlist = array_merge ( $dirlist , $result ) ;
       }
       }
       closedir ( $handle ) ;
   }
   if ( $d == 0 ) { natcasesort ( $dirlist ) ; }
   return ( $dirlist ) ;
}

BTW, I did a clean install in the morning. Just installation, no modules, no changes, nothing. Still the same warning above 4 subdirectories.

Bernd
Pierre M.

Re: Warning if creating more than 4 subdirs

Post by Pierre M. »

So the restriction of your PHP provider impacts both CMSms and other software. Hence it is a PHP hosting issue and not CMSms related. You must find another hosting solution. May be with the same provider but with a relaxed policy.

Pierre M.
klenkes
Power Poster
Power Poster
Posts: 307
Joined: Mon Sep 08, 2008 9:43 am

Re: Warning if creating more than 4 subdirs

Post by klenkes »

Yes. Was a surprise for me too.

They wrote back this afternoon and promissed me to look into the matter and maybe raise the limit.

It is not a noname provider and the guys are always quite concerned about security issues. Their support answers very quickly and they never drop a case before all people involved are satisfied.

Soo... I think I put a "solved" to my post.
Post Reply

Return to “CMSMS Core”