Support » Plugin: Sightings » [Plugin: Sightings] File error/PHP version and __DIR__

  • Doing a bit of diggging for an issue I had earlier today, it seems that PHP versions less than 5.3.0 will break the plugin. The __DIR__ constant is only available in version 5.3.0 or higher.

    I fixed this by replacing __DIR__ with dirname(__FILE__) in the /sightings/theme-files/filters.php file. One could use a conditional based on PHP version to handle it, in case dirname(__FILE__) is deprecated.

    Here is the error message I got before modifying the plugin:

    Warning: include(__DIR__/shortcode-sightings-map.php) [function.include]: failed to open stream: No such file or directory in /usr/www/users/xxxxxxxxxx/wp-content/plugins/sightings/theme-files/filters.php on line 14
    Warning: include() [function.include]: Failed opening '__DIR__/shortcode-sightings-map.php' for inclusion (include_path='.:/usr/local/lib/php') in /usr/www/users/xxxxxxxxxx/wp-content/plugins/sightings/theme-files/filters.php on line 14

    Hope this helps! I will just have to remember to edit the plugin whenever it receives an update.

Viewing 6 replies - 1 through 6 (of 6 total)
  • hi rudy64,

    thanks for your post. I have the same problem… but when I user __FILE__ instead of __DIR__ I still get this error:

    Warning: include(/home/xxxxxx/public_html/wp-content/plugins/sightings/theme-files/filters.php/shortcode-sightings-map.php) [function.include]: failed to open stream: Not a directory in /home/xxxxxx/public_html/wp-content/plugins/sightings/theme-files/filters.php on line 14
    Warning: include() [function.include]: Failed opening '/home/xxxxxx/public_html/wp-content/plugins/sightings/theme-files/filters.php/shortcode-sightings-map.php' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/xxxxxx/public_html/wp-content/plugins/sightings/theme-files/filters.php on line 14

    can you pls. post here your full code of filters.php – perhaps I might have done wrong – but I only replaced __DIR__ with __FILE__

    Only one change to make in the file.



    The entire line should read:

    dirname(__FILE__) . '/shortcode-sightings-map.php';

    __FILE__ has been in PHP since version 4.0.2, and I doubt hardly anyone has a PHP version that old anymore. __FILE__ is the entire file path; the dirname() function tells PHP to retrieve only the directory portion of the path.

    The plugin didn’t do what I wanted, so I’ve uninstalled it. At least I was able to help troubleshoot it. 🙂

    hi rudy!

    thank you very much for your clarification.
    unfortunately i didn´t helped…
    but my provider was so kindly to update the PHP version to 5.3.
    so now Sightings works at least although there are still a lot of bugs in the code…

    Plugin Author webdez


    Yes, as stated on the plugin page, Sightings system requirements is PHP 5.3 or later.
    There’s a lot of bugs. I’m sorry about those, please keep reporting them as you find them and I’ll fix them as soon as possible. Also please update to the latest bugfix released tonight to solve some of them.

    Cool that you’re on top of it–thanks! The sad part of it is, there are still hosts out there (major ones at that) who run older versions of PHP. I can compile and run any version I want if I run it as CGI, but to go with the mod_php in Apache, I have to use what the host offers.

    You’ve probably found like I do–you spend more time squashing obscure bugs than creating new features.


    My web hosting company I use has PHP 5.3.13 installed and I am still having the same problem as every one else.

    Below is the error msg I receive after activating the plugin.

    Warning: include(__DIR__shortcode-sightings-map.php) [function.include]: failed to open stream: No such file or directory in /hermes/bosweb/web097/b970/#removedforprivacy#/public_html/zendamaparanormal/wp-content/plugins/sightings/theme-files/filters.php on line 15
    Warning: include() [function.include]: Failed opening '__DIR__shortcode-sightings-map.php' for inclusion (include_path='.:/usr/local/lib/php-5.2.17/lib/php') in /hermes/bosweb/web097/b970/#removedforprivacy#/public_html/zendamaparanormal/wp-content/plugins/sightings/theme-files/filters.php on line 15

    I have replaced the __DIR__ with dirname(__FILE__) on line 15

    When I do this another error comes up and completely takes down my site. That error msg is:

    Parse error: syntax error, unexpected T_PAAMAYIM_NEKUDOTAYIM in /hermes/bosweb/web097/b970/#removedforprivacy#/public_html/zendamaparanormal/wp-content/plugins/sightings/theme-files/shortcode-sightings-map.php on line 184

    Please help as this plugin is exactly what our site needs.

    Thank you,
    David B.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘[Plugin: Sightings] File error/PHP version and __DIR__’ is closed to new replies.