Forum Moderators: coopster

Message Too Old, No Replies

PHP Timeout error

         

andrewsmd

12:35 pm on Sep 30, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I have a php file that searches a directory for a filename wildcard and returns the file names. The problem is, some of these directories I search are massive (10s of 1000s of files) and if the user types in a wildcard i.e. * then it returns everything and my PHP just times out and doesn't output anything. Anyone have any idea around this. My logic is rather simple, the user puts in some input in a textbox i.e. a path like c:\some folder\*.txt and then I create and array using glob($userInput) and then echo all of the file names. Any ideas?

jatar_k

1:00 pm on Sep 30, 2008 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



just don't allow wildcards

or am I over simplifying?

andrewsmd

1:53 pm on Sep 30, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Well that would solve my problem but defeat the purpose of my whole php file. I would post code but it is very long and calls many other functions, I was just wondering if anyone had any logic suggestions. Basically we have archive files at my work and sometimes we need to find a file that contains a number. Well if you try to open those archive folders most of the time it will freeze up the machine because they are so big. Now for a nerd like me it's fine because I can go in through the dos prompt. But, our secretaries and other people need to search these folders sometimes. So I created a little php site that searches on our local intranet for them. It works fine if you keep the number of files in the search down to about under 1500. Anything over that and the PHP server just quits.

andrewsmd

1:55 pm on Sep 30, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Now if you are smart enough you can work around it. Meaning instead of entering * entering *200809* because that will only return things from this month. The problem is, this needs to be idiot proof because I can't give a 10 minute lecture to everyone who wants to use it, and I would also like it to be functioning well in case I would leave here.

jatar_k

1:57 pm on Sep 30, 2008 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



well the true problem is definitely the archive sysytem is unusable in it's current setup

so a hack

any way to archive the searches done or find most popular searches?

any way to further split up or classify the archives that are there?

jatar_k

1:58 pm on Sep 30, 2008 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



if it is always a date then you could build a set of drop downs for the search and construct the string instead of being free form

goes back to how your users are using the search