• I just updated the plugin and now I’m getting this error “Directory is not executable! C:\####\wordpress\wp-content\plugins\php-snippets/snippets Please adjust your file permisions”

    The same thing happens when i tried to edit the snippet directory “The selected directory is not executable. Please adjust your file permissions. C:\\####\\wordpress\\wp-content\\customphp”

    I did not change the permissions or anything else. All I did was update the plugin. I went and double checked and both directories have full permissions.

    https://www.ads-software.com/extend/plugins/php-snippets/

Viewing 15 replies - 1 through 15 (of 18 total)
  • Define “full permissions”…. Windows servers sometimes have trouble with permissions like this — what are the permissions on that directory and who owns the files? Also, what user is PHP running under? Also, which version of PHP are you using?

    Finally, was this working before?

    I suspect my permissions check isn’t working on Windows — I don’t have access to a windows server, so it’s hard for me to test.

    Thread Starter chaos_cb7

    (@chaos_cb7)

    php and everything is running under the same user. servername/username. this is also the owner of the file. I have the directory set up though that even normal user accounts have full access to the directories and its still not working.

    running PHP Version 5.3.8

    yes everything was working fine before.

    Man, I’d love to troubleshoot this on your server. Any chance you could set me up with a WP Admin user and an FTP login?

    In the meantime, you can override the check_permissions() function inside of includes/PHP_Snippet_Functions.php — line 66… just force the function to return true:

    public static function check_permissions($dir) {
    		return true;
    	}

    If it comes back true, the plugin will assume it’s all good. Comment out the lines in that function above that statement.

    Thread Starter chaos_cb7

    (@chaos_cb7)

    that worked for the default directory and I’m able to get the script working on the page but it seems like I’m still getting that error when I try and assign a different directory under settings.

    this is on a live website so I can’t really give out admin rights

    Understandable, but I can’t troubleshoot it any further because my Linux servers don’t have that problem.

    There is one other check inside controllers/settings.php: comment out this bit @ line 31-33:

    elseif(!is_executable($snippet_dir)) {
    		$data['msg'] = sprintf('<div class="error"><p>%s %s</p></div>', 'The selected directory is not executable.  Please adjust your file permissions.', "<code>$snippet_dir</code>");
    	}

    Other than that, the only solution I can offer is for you to role back to 0.6.

    Thread Starter chaos_cb7

    (@chaos_cb7)

    thats fixed it

    The directory and file permission system under Windows is entirely different than under Linux. I can confirm that the directory security changes you made in Version 0.7 are not compatible with the Windows server directory and file permission system.

    There is a second Windows compatibility problem in Version 0.7 that also exists in 0.6. Each time the Update button on the PHP Settings page is clicked the number of slash characters in the entered path to the snippets directory doubles. For example, if this path is entered:

    C:\public\www.domain.com\php-snippets

    After the button is clicked the path changes to this:

    C:\\public\\www.domain.com\\php-snippets

    If the button is clicked again the path becomes this:

    C:\\\\public\\\\www.domain.com\\\\php-snippets

    Normally, I could offer you admin login credentials to a test WordPress installation running under Windows, but I am using my test server myself to develop something critical at the moment.

    Ah… the slash thing: that’s probably be WP’s habit of slashing everything regardless of PHP’s quote settings. I’ll look into it.

    I don’t have a Windows server to test on, so I’m kinda flying blind on that part of it. If anyone can hook me up with some logins I can test this on Windows.

    hii, i got the same problem. my page is hosted on a linux webserver, but i can give the snippet directory full access rights (777) and it still comes with the error: Directory is not executable! /var/www/web89/html/wp-content/plugins/php-snippets/snippets Please adjust your file permisions.

    you may can help me?

    Send me info to the email address listed at https://fireproofsocks.com/contact/ and I can take a look.

    I’ve made some research and seem to manage this issue.

    I found that is_executable() function is not always reliable for checking directories.

    I’ve changed 2 lines of code:

    includes\PHP__Snippet_Functions.php
    line 76
    if (!is_writable($dir)) {

    controllers/settings.php
    line 31
    elseif(!is_writable($snippet_dir)) {

    And now it works under my Windows OS.
    It has to be checked under Linux/Unix OS.

    I’m getting these errors after activating the plugin:

    Warning: scandir(/var/www/clients/client3/web22/web/snippets/..) [function.scandir]: failed to open dir: Permission denied in /var/www/clients/client3/web22/web/wp-content/plugins/php-snippets/includes/PHP_Snippet_Functions.php on line 171

    Warning: scandir() [function.scandir]: (errno 13): Permission denied in /var/www/clients/client3/web22/web/wp-content/plugins/php-snippets/includes/PHP_Snippet_Functions.php on line 171

    Warning: Invalid argument supplied for foreach() in /var/www/clients/client3/web22/web/wp-content/plugins/php-snippets/includes/PHP_Snippet_Functions.php on line 172

    Any fix for these?

    Which version of the plugin are you running?

    Also, what directory have you configured to be the one that contains your snippets and are you 100% sure you have entered in a valid path to that directory? Finally, which OS are you running on your server? Windows does not report permissions the same as Linux, but I have no access to a Windows server, so it’s been almost impossible for me to troubleshoot this. I get this question all the time, and most of the time the cause is misconfiguration.

    Hi! I have deactivated the plugin temporarily. Below are my responses to your questions.

    1. I’m running version 0.8 of the plugin
    2. I created a subfolder (snippets) right under the website’s folder, put in a PHP page that displays what getcwd() returns and put that in the plugin’s setting: /var/www/clients/client3/web22/web/snippets/
    3. I’m running Linux

    I have also configured the subfolder to for all kinds of access: 777 and that includes the only file there right now, which is the PHP file I mention above.

    I hope that sheds light on the matter.

Viewing 15 replies - 1 through 15 (of 18 total)
  • The topic ‘[Plugin: PHP Snippets] Directory is not executable! error’ is closed to new replies.