Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free.

Introduction

I'm creating an Android app for webpage that runs on Joomla 1.5. Yes I know that it's an old version etc. but it's not my site and I can't do anything about it. So basically I'm creating a PHP script that fetches data from database and returns it as JSON. Website uses gallery extension: http://www.joomlaworks.net/extensions/free/simple-image-gallery

So I have images directory for example: images/stories/news/today-news and in this directory are photos that are displayed on website. Now in my script I'm using PHP scandir() function to list all the images from given directory.

Problem

For some directories scandir() returns list of files but for other directories it returns null. Let's say we have two directories:

images/stories/news/today-news - for this directory it's working correctly

images/stories/news/yesterday-news - for this directory it returns null

When I open first (working) directory in webbrowser then I get 403 Forbidden which I think is correct. But when I open second directory it returns 404 Not found like there is no directory like this. But on Joomla website both directories seems to work. I can see galleries from both directories. Both of them have chmod 755.

What can be wrong? What am I missing?

share

migration rejected from joomla.stackexchange.com Jun 17 at 11:07

This question came from our site for Joomla! administrators, users, developers and designers. Votes, comments, and answers are locked due to the question being closed here, but it may be eligible for editing and reopening on the site where it originated.

closed as unclear what you're asking by MichaelT, durron597, Snowman, gnat, Bart van Ingen Schenau Jun 17 at 11:07

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

    
Double check the path. It's case-sensitive. Check if it's a relative or absolute path. The return value for scandir() is either an array or false and not null. –  Farahmand Oct 8 '14 at 9:47
1  
Did you try is_dir()? Do you have an ftp account to check whether it's a directory or not? Did you check the .htaccess file? –  Farahmand Oct 8 '14 at 11:55
1  
Your owner expects you to create a script for him to upload each time you wish to test something? Makes trial and error much harder. Can you not get him/her to give you FTP access? Perhaps ask for a backup of the site to you can test locally –  Lodder Oct 8 '14 at 12:28
1  
No problem. It may be due to a directory permission or in a rare case, a bug: bugs.php.net/bug.php?id=42832 –  Farahmand Oct 8 '14 at 12:38
1  
I am voting to close this question as off-topic because it is an implementation question. However, it is too old to migrate to Stack Overflow. –  Snowman Jun 15 at 0:30