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, no registration required.

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|improve this question

migrated from joomla.stackexchange.com Dec 5 '14 at 16:33

This question came from our site for Joomla! administrators, users, developers and designers.

    
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
    
Ah yes, it's false. Path is correct, because I'm getting it from article's body. This gallery system uses tags like: {gallery}images/stories/news/today-news{/gallery} so the path is correct. I compared it to the path from gallery on website and it's the same. I think it something with permissions but I'm not Joomla or webdev expert... –  jand Oct 8 '14 at 10:00
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

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.