Title: PHP Error mkdir() with fix
Last modified: August 31, 2016

---

# PHP Error mkdir() with fix

 *  [andiv88](https://wordpress.org/support/users/andiv88/)
 * (@andiv88)
 * [10 years ago](https://wordpress.org/support/topic/php-error-mkdir-with-fix/)
 * Hi,
 * Have some php errors in iThemes Security 5.3.7 but already fixed it in CORE. 
   It would be cool if you add fixes in next release.
 * See below
 * PHP Error
 * Warning mkdir() [function.mkdir]: File exists
 * Location wp-content/plugins/better-wp-security/core/class-itsec-files.php:331
 * Call Stack
 * mkdir()
    wp-content/plugins/better-wp-security/core/class-itsec-files.php:331
   ITSEC_Files->get_file_lock() wp-content/plugins/better-wp-security/core/modules/
   file-change/class-itsec-file-change.php:169 ITSEC_File_Change->execute_file_check()
   Unknown location do_action(‘init’) wp-settings.php:392
 * SOLUTION
    // add a check whether directory is already exists before making new
   directory at wp-content/plugins/better-wp-security/core/class-itsec-files.php:
   331
 *     ```
       if ( ! @is_dir( $lock_file ) ) {
   
       			@mkdir( $lock_file );
       		}
       		else {
       		// if ( false === @mkdir( $lock_file ) ) {
   
       			if ( false !== $dir_age ) {
   
       				if ( ( time() - $dir_age ) > intval( $exp ) ) { //see if the lock has expired
   
       					@rmdir( $lock_file );
       					@mkdir( $lock_file );
   
       				} else { //couldn't get the lock
   
       					return false;
   
       				}
   
       			} else {
   
       				return false;
   
       			}
   
       		}
       ```
   
 * Andrey
 * [https://wordpress.org/plugins/better-wp-security/](https://wordpress.org/plugins/better-wp-security/)

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

 *  [dwinden](https://wordpress.org/support/users/dwinden/)
 * (@dwinden)
 * [10 years ago](https://wordpress.org/support/topic/php-error-mkdir-with-fix/#post-7379335)
 * [@andiv88](https://wordpress.org/support/users/andiv88/)
 * Where is that PHP error displayed (in the browser or somewhere in a log file)
   and what PHP version are you using ?
 * I wonder why you get a PHP Warning when the mkdir() command is prepended with
   a @ ?
 * dwinden
 *  Thread Starter [andiv88](https://wordpress.org/support/users/andiv88/)
 * (@andiv88)
 * [10 years ago](https://wordpress.org/support/topic/php-error-mkdir-with-fix/#post-7379340)
 * [@dwinden](https://wordpress.org/support/users/dwinden/)
 * Warning showed in Query Monitor plugin 2.10.0 which displays errors in wp admin
   pannel. I think that in log will be the same error if warning level is activated
   php config. PHP version is 5.3
 *  [dwinden](https://wordpress.org/support/users/dwinden/)
 * (@dwinden)
 * [10 years ago](https://wordpress.org/support/topic/php-error-mkdir-with-fix/#post-7379343)
 * [@andiv88](https://wordpress.org/support/users/andiv88/)
 * Thank you for that clarification.
 * After reading about the Query Monitor plugin in your last post I remembered having
   seen something similar recently so I went back in the forum history and found
   [this](https://wordpress.org/support/topic/php-warning-mkdir-file-exists) fairly
   recent topic.
 * Please ignore my comments in that topic. I now have a better understanding of
   what is happening than at the time of me posting in that topic.
 * I guess there is no harm in PHP warnings being displayed in the Query Monitor
   plugin only and nowhere else.
    I don’t think the warning level activated in php
   config will overrule the @ prepending … but I might be wrong.
 * In any case this has absolutely no impact whatsoever on the functioning of the
   iTSec plugin. Just a minor cosmetic thing.
 * dwinden
 *  Thread Starter [andiv88](https://wordpress.org/support/users/andiv88/)
 * (@andiv88)
 * [10 years ago](https://wordpress.org/support/topic/php-error-mkdir-with-fix/#post-7379344)
 * [@dwinden](https://wordpress.org/support/users/dwinden/)
 * Sure, agree with you. It just UX matter for those who use Query Monitor plugin
   as it shows red caution at the top of admin pannel.
 * Thanks
 *  [dwinden](https://wordpress.org/support/users/dwinden/)
 * (@dwinden)
 * [10 years ago](https://wordpress.org/support/topic/php-error-mkdir-with-fix/#post-7379346)
 * [@andiv88](https://wordpress.org/support/users/andiv88/)
 * Exactly.
 * Would it be possible to include a link to a screenshot which shows that Query
   Monitor plugin red caution ?
 * dwinden

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

The topic ‘PHP Error mkdir() with fix’ is closed to new replies.

 * ![](https://ps.w.org/better-wp-security/assets/icon.svg?rev=3529351)
 * [Kadence Security – Password, Two Factor Authentication, and Brute Force Protection](https://wordpress.org/plugins/better-wp-security/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/better-wp-security/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/better-wp-security/)
 * [Active Topics](https://wordpress.org/support/plugin/better-wp-security/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/better-wp-security/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/better-wp-security/reviews/)

 * 5 replies
 * 2 participants
 * Last reply from: [dwinden](https://wordpress.org/support/users/dwinden/)
 * Last activity: [10 years ago](https://wordpress.org/support/topic/php-error-mkdir-with-fix/#post-7379346)
 * Status: not resolved