Search code examples
linuxflickrphp

Running PHP code from CLI and from Browser giving different results


I have stuck in a strange situation, I have a code to fetch albums from flickr. test.php

http://example.com/cron/test.php?uid=613

    $f->setToken($user_token);
    $all_album_list =   $f->photosets_getList($user_flickr_id);
    print_r("Total Albums".sizeof($all_album_list['photoset']));

when i hit this in the browser it show me that i have 43 albums and first album name is 66 / part 3

and creates object on s3 with the name of 66 / part 3

But when the same i run on shell

#php -q /var/www/web1/test.php

When i hit this code runs fine just it shows me that i have 39 Albums and the name of first album is 66 while i have no album with the name of 66, there is result difference from CLI and browser,

running with php -q result is different but when i run on CLI with Wget then the result is accurate and same as browser.

What could be the reason of this problem.


Solution

  • Check your scripts permission issue, is it same as web browser and also check your PHP Version from command line Using PHP -v and also from browser using phpinfo() method, If you have different versions this may be the reason.