Title: [Plugin: PHP Snippets] Directory is not executable! error
Last modified: August 20, 2016

---

# [Plugin: PHP Snippets] Directory is not executable! error

 *  [chaos_cb7](https://wordpress.org/support/users/chaos_cb7/)
 * (@chaos_cb7)
 * [14 years, 3 months ago](https://wordpress.org/support/topic/plugin-php-snippets-directory-is-not-executable-error/)
 * 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.
 * [http://wordpress.org/extend/plugins/php-snippets/](http://wordpress.org/extend/plugins/php-snippets/)

Viewing 15 replies - 1 through 15 (of 18 total)

1 [2](https://wordpress.org/support/topic/plugin-php-snippets-directory-is-not-executable-error/page/2/?output_format=md)
[→](https://wordpress.org/support/topic/plugin-php-snippets-directory-is-not-executable-error/page/2/?output_format=md)

 *  [fireproofsocks](https://wordpress.org/support/users/fireproofsocks/)
 * (@fireproofsocks)
 * [14 years, 3 months ago](https://wordpress.org/support/topic/plugin-php-snippets-directory-is-not-executable-error/#post-2550918)
 * 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](https://wordpress.org/support/users/chaos_cb7/)
 * (@chaos_cb7)
 * [14 years, 3 months ago](https://wordpress.org/support/topic/plugin-php-snippets-directory-is-not-executable-error/#post-2550919)
 * 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.
 *  [fireproofsocks](https://wordpress.org/support/users/fireproofsocks/)
 * (@fireproofsocks)
 * [14 years, 3 months ago](https://wordpress.org/support/topic/plugin-php-snippets-directory-is-not-executable-error/#post-2550920)
 * 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](https://wordpress.org/support/users/chaos_cb7/)
 * (@chaos_cb7)
 * [14 years, 3 months ago](https://wordpress.org/support/topic/plugin-php-snippets-directory-is-not-executable-error/#post-2550925)
 * 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
 *  [fireproofsocks](https://wordpress.org/support/users/fireproofsocks/)
 * (@fireproofsocks)
 * [14 years, 3 months ago](https://wordpress.org/support/topic/plugin-php-snippets-directory-is-not-executable-error/#post-2550928)
 * 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](https://wordpress.org/support/users/chaos_cb7/)
 * (@chaos_cb7)
 * [14 years, 3 months ago](https://wordpress.org/support/topic/plugin-php-snippets-directory-is-not-executable-error/#post-2550933)
 * thats fixed it
 *  [admintiger](https://wordpress.org/support/users/admintiger/)
 * (@admintiger)
 * [14 years, 3 months ago](https://wordpress.org/support/topic/plugin-php-snippets-directory-is-not-executable-error/#post-2550970)
 * 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.
 *  [fireproofsocks](https://wordpress.org/support/users/fireproofsocks/)
 * (@fireproofsocks)
 * [14 years, 3 months ago](https://wordpress.org/support/topic/plugin-php-snippets-directory-is-not-executable-error/#post-2551043)
 * 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.
 *  [zisu11](https://wordpress.org/support/users/zisu11/)
 * (@zisu11)
 * [14 years ago](https://wordpress.org/support/topic/plugin-php-snippets-directory-is-not-executable-error/#post-2551209)
 * 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?
 *  [fireproofsocks](https://wordpress.org/support/users/fireproofsocks/)
 * (@fireproofsocks)
 * [14 years ago](https://wordpress.org/support/topic/plugin-php-snippets-directory-is-not-executable-error/#post-2551210)
 * Send me info to the email address listed at [http://fireproofsocks.com/contact/](http://fireproofsocks.com/contact/)
   and I can take a look.
 *  [tvardy](https://wordpress.org/support/users/tvardy/)
 * (@tvardy)
 * [13 years, 8 months ago](https://wordpress.org/support/topic/plugin-php-snippets-directory-is-not-executable-error/#post-2551244)
 * 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.
 *  [fireproofsocks](https://wordpress.org/support/users/fireproofsocks/)
 * (@fireproofsocks)
 * [13 years, 8 months ago](https://wordpress.org/support/topic/plugin-php-snippets-directory-is-not-executable-error/#post-2551245)
 * Thanks! Adding this to the issue tracker: [http://code.google.com/p/wordpress-php-snippets/issues/detail?id=15](http://code.google.com/p/wordpress-php-snippets/issues/detail?id=15)
 *  [tulisan](https://wordpress.org/support/users/tulisan/)
 * (@tulisan)
 * [13 years, 8 months ago](https://wordpress.org/support/topic/plugin-php-snippets-directory-is-not-executable-error/#post-2551248)
 * 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?
 *  [fireproofsocks](https://wordpress.org/support/users/fireproofsocks/)
 * (@fireproofsocks)
 * [13 years, 8 months ago](https://wordpress.org/support/topic/plugin-php-snippets-directory-is-not-executable-error/#post-2551250)
 * 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.
 *  [tulisan](https://wordpress.org/support/users/tulisan/)
 * (@tulisan)
 * [13 years, 8 months ago](https://wordpress.org/support/topic/plugin-php-snippets-directory-is-not-executable-error/#post-2551251)
 * 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)

1 [2](https://wordpress.org/support/topic/plugin-php-snippets-directory-is-not-executable-error/page/2/?output_format=md)
[→](https://wordpress.org/support/topic/plugin-php-snippets-directory-is-not-executable-error/page/2/?output_format=md)

The topic ‘[Plugin: PHP Snippets] Directory is not executable! error’ is closed 
to new replies.

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

 * 18 replies
 * 6 participants
 * Last reply from: [fireproofsocks](https://wordpress.org/support/users/fireproofsocks/)
 * Last activity: [13 years, 7 months ago](https://wordpress.org/support/topic/plugin-php-snippets-directory-is-not-executable-error/page/2/#post-2551254)
 * Status: not resolved