Title: [Plugin: Sightings] File error/PHP version and __DIR__
Last modified: August 20, 2016

---

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

 *  [Rudy64](https://wordpress.org/support/users/rudy64/)
 * (@rudy64)
 * [14 years, 1 month ago](https://wordpress.org/support/topic/plugin-sightings-file-error/)
 * 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.
 * [http://wordpress.org/extend/plugins/sightings/](http://wordpress.org/extend/plugins/sightings/)

Viewing 6 replies - 1 through 6 (of 6 total)

 *  [bergblume](https://wordpress.org/support/users/bergblume/)
 * (@bergblume)
 * [14 years, 1 month ago](https://wordpress.org/support/topic/plugin-sightings-file-error/#post-2610982)
 * 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
   s.th. wrong – but I only replaced __DIR__ with __FILE__
 *  Thread Starter [Rudy64](https://wordpress.org/support/users/rudy64/)
 * (@rudy64)
 * [14 years, 1 month ago](https://wordpress.org/support/topic/plugin-sightings-file-error/#post-2611005)
 * Only one change to make in the file.
 * Replace:
    `__DIR__`
 * with:
    `dirname(__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. 🙂
 *  [bergblume](https://wordpress.org/support/users/bergblume/)
 * (@bergblume)
 * [14 years, 1 month ago](https://wordpress.org/support/topic/plugin-sightings-file-error/#post-2611128)
 * 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](https://wordpress.org/support/users/webdez/)
 * (@webdez)
 * [14 years ago](https://wordpress.org/support/topic/plugin-sightings-file-error/#post-2611141)
 * Yes, as stated on the [plugin page](http://wordpress.org/extend/plugins/sightings/),
   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.
 *  Thread Starter [Rudy64](https://wordpress.org/support/users/rudy64/)
 * (@rudy64)
 * [14 years ago](https://wordpress.org/support/topic/plugin-sightings-file-error/#post-2611142)
 * 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.
 *  [ZendamaParanormal](https://wordpress.org/support/users/zendamaparanormal/)
 * (@zendamaparanormal)
 * [13 years, 9 months ago](https://wordpress.org/support/topic/plugin-sightings-file-error/#post-2611184)
 * Hello
 * 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.

 * ![](https://s.w.org/plugins/geopattern-icon/sightings_a6a69d.svg)
 * [Sightings](https://wordpress.org/plugins/sightings/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/sightings/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/sightings/)
 * [Active Topics](https://wordpress.org/support/plugin/sightings/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/sightings/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/sightings/reviews/)

## Tags

 * [__DIR__](https://wordpress.org/support/topic-tag/__dir__/)

 * 6 replies
 * 4 participants
 * Last reply from: [ZendamaParanormal](https://wordpress.org/support/users/zendamaparanormal/)
 * Last activity: [13 years, 9 months ago](https://wordpress.org/support/topic/plugin-sightings-file-error/#post-2611184)
 * Status: not resolved