WordPress.org

Support

Support » Plugins and Hacks » PHP Snippets » [Resolved] [Plugin: PHP Snippets] Permissions denied

[Resolved] [Plugin: PHP Snippets] Permissions denied

  • Looks great but after setting the path I get

    ng: scandir(/home/mysite/snippets/..) [function.scandir]: failed to open dir: Permission denied in /home/mysite/public_html/wp-content/plugins/php-snippets/includes/PHP_Snippet_Functions.php on line 119

    Warning: scandir() [function.scandir]: (errno 13): Permission denied in /home/mysite/public_html/wp-content/plugins/php-snippets/includes/PHP_Snippet_Functions.php on line 119

    Warning: Invalid argument supplied for foreach() in /home/mysite/public_html/wp-content/plugins/php-snippets/includes/PHP_Snippet_Functions.php on line 120

    http://wordpress.org/extend/plugins/php-snippets/

Viewing 6 replies - 1 through 6 (of 6 total)
  • Sounds like a permissions issue on your webserver. Did you edit your response above, or is your username really “mysite”? Just making sure… “mysite” is just an example, so I want to make sure you have in fact updated it with your own path. What path have you specified for the settings there? Does that directory exist and can PHP read it?

    “mysite” is just hiding the actual username.

    The directory exists below the root where it should. I’ve had other directories/folders there and everything has worked just fine. I’m at a loss to explain why it’s not working here. I set the directory to 777 as well. I recreated the directory, no luck. Put it into the webroot and it took me 2 tries to save – and then it worked but only in the public area.

    Then I ended up putting the same folder below the webroot. I had to save twice – then it worked. I can’t explain it, but that’s how I got it to work. I’ll change this to resolved but something you may want to look at.

    Odd. If you save once and return to the settings page and your changes are there, then the new setting was saved correctly. When you came back to save the 2nd time had your changes been made, or did you have to re-enter the path?

    Nope – it only works in the webroot directory, not below it. So I moved the folder into the webroot and I had to save it twice – and here is what is weird. When I viewed the plugin it returned the correct path. However, I had to click save again and then the error message went away. Now it works from the webroot like a charm. It’s the only “php in a post” plugin I see that works that doesn’t take down the server or cause numerous errors. Testing it but great work.

    I wonder if this has something to do with your server permissions: some setups don’t like PHP to scan directories above document root (I think Plesk in particular doesn’t like that). When saving, the plugin does scan the directory in order to warn the user if the directory either doesn’t exist or is not readable… so maybe that’s what’s causing the hiccup when saving… maybe the directory above web-root has some restrictions on scanning, and I’m not handling the error correctly. I’ll look into this, so thank you for bringing it to my attention.

    Thanks for the kind words — I hope the plugin is useful to you; if it is, consider making a donation to keep the magic alive. I got frustrated with the handful of other PHP plugins I found that used “eval”, and that just gets messy because the error reporting always pointed back to the parent plugin instead of to the user’s code that contains the error, so they made it much more difficult for the user/developer to debug their code. And I finally cut my teeth with the TinyMCE buttons here to make it easy to get those scripts into your posts.

    I updated the plugin to version 0.7 — I did some extra work to check the permissions on the snippet directory, so hopefully that catches this type of situation in the future.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘[Resolved] [Plugin: PHP Snippets] Permissions denied’ is closed to new replies.
Skip to toolbar