WordPress.org

Ready to get started?Download WordPress

Forums

Sightings
File error/PHP version and __DIR__ (7 posts)

  1. Rudy64
    Member
    Posted 2 years ago #

    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/

  2. bergblume
    Member
    Posted 2 years ago #

    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__

  3. Rudy64
    Member
    Posted 2 years ago #

    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. :)

  4. bergblume
    Member
    Posted 2 years ago #

    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...

  5. webdez
    Member
    Plugin Author

    Posted 2 years ago #

    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.

  6. Rudy64
    Member
    Posted 2 years ago #

    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.

  7. ZendamaParanormal
    Member
    Posted 2 years ago #

    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.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic