0

So I have this working on my local testing machine and it works fine. However as soon as I upload it to my hosting provider it gives me an HTTP error 500 and wont go any further. The part of the script that is giving trouble is:

function collect_directories_and_files($path) {
$entries = scandir($path);
return array_partition($entries, function($entry) {
    return is_dir($entry);
});
}

More specifically:

 return array_partition($entries, function($entry) {

This is the line that the error logs are calling out as the problem. I dont see any syntax errors...am I missing something?

EDIT: Apparently this is an issue with PHP 5.2 and annonymous functions.

3
  • "This is the line that the error logs are calling out as the problem. I dont see any syntax errors...am I missing something?" - yeah, and we too, required to answer this question: what is the error? Commented May 29, 2013 at 19:02
  • It was an HTTP error 500 but when I got to digging it was a T_FUNCTION error and with some research it has something to do with PHP 5.2 and annonymous function or so I think. Maybee someone will have a better answer. Commented May 29, 2013 at 19:47
  • The exact error might help, but if I must guess, you may not call your function function. Try renaming it. Commented May 29, 2013 at 21:15

1 Answer 1

1

See if you have enough permission to list the files/directories on the path.

It's working because maybe you have permissions on your local host but you don't on the remote.

Sign up to request clarification or add additional context in comments.

1 Comment

Permissions for the folder and the file are set to 755 im not sure Im tracking your meaning on "permissions" they are set the same on both setups.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.