简体   繁体   中英

mkdir(): Not a directory PHP

I'm creating a path with codeigniter on PHP and I'm getting this php error:

A PHP Error was encountered
Severity: Warning
Message: mkdir(): Not a directory
Filename: devotee/acc.devotee.php
Line Number: 81

Here is the line of code that php is complaining about

    // Set cache settings
    $this->_cache_path = $this->EE->config->item('devotee_monitor_cachepath') ? $this->EE->config->item('devotee_monitor_cachepath') : APPPATH . 'cache/devotee/';
    $this->_cache_time = 60 * 60; // 1 hour

    // Create cache folder if it doesn't exist

    if(! is_dir($this->_cache_path))
    {
        mkdir($this->_cache_path, DIR_WRITE_MODE);
    }

Also, in addition to checking what $this->_cache_path is resolving to as Bassem Samir mentions, make sure that your param to mkdir() does not have a trailing slash. For example,

mkdir("some_dir");

... Works

Whereas

mkdir("some_dir/");

... Doesn't work.

In other words, mkdir() will expect something to follow the slash: the sub folder. If not present, you'll get an error.

You should check the content of $this->_cache_path . It can be empty so mkdir throws warning message.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM