WordPress Trac: Ticket #6097: Warning</b>: mkdir() [<a href='function.mkdir'>function.mkdir</a>]: No such file or directory in <b>~/wp-includes/js/tinymce/tiny_mce_config.php</b> on line <b>158</b>https://core.trac.wordpress.org/ticket/6097
<p>
TinyMCE was failing to load on a fresh install, I noticed a JS error in the console, which turned out to be this PHP error.
</p>
<p>
It causes an error if it cannot create the temp. cache dir, This would happen if the permissions do not allow the folder to be created, Or, if the uploads folder does not allready exist (Which is doesnt on fresh installs it seems).
</p>
<p>
Atached patch silences error outputs, and attempts to create the upload folder if it does not allready exist.
</p>
en-usWordPress Trachttps://core.trac.wordpress.org/chrome/site/your_project_logo.pnghttps://core.trac.wordpress.org/ticket/6097
Trac 1.0.1DD32Tue, 04 Mar 2008 23:47:02 GMTattachment sethttps://core.trac.wordpress.org/ticket/6097
https://core.trac.wordpress.org/ticket/6097
<ul>
<li><strong>attachment</strong>
set to <em>6097.diff</em>
</li>
</ul>
TicketryanTue, 04 Mar 2008 23:52:24 GMThttps://core.trac.wordpress.org/ticket/6097#comment:1
https://core.trac.wordpress.org/ticket/6097#comment:1
<p>
This should use wp_upload_dir(). That function finds the right upload directory, makes sure it exists, and makes sure it has the correct perms.
</p>
TicketryanTue, 04 Mar 2008 23:54:06 GMThttps://core.trac.wordpress.org/ticket/6097#comment:2
https://core.trac.wordpress.org/ticket/6097#comment:2
<p>
And then wp_mkdir_() can be used to make the js_cache directory beneath wp_upload_dir(). Or, we can just wp_mkdir_p() the cache dir directly within wp-content.
</p>
TicketDD32Wed, 05 Mar 2008 00:29:16 GMThttps://core.trac.wordpress.org/ticket/6097#comment:3
https://core.trac.wordpress.org/ticket/6097#comment:3
<p>
I was wondering why it was in the upload dir. and not a cache dir or such, I assumed it was because the more lax permissions that are generally enabled for the upload dir in environments which need it.
</p>
<p>
wp_upload_dir() returns the current month upload folder if WP is set to organise uploads into year/month folders (Which IMO, a lot of people seem to do).
</p>
<p>
I've updated this to use wp_mkdir_p() instead. as for wp_upload_dir() maybe can return a extra element 'base' (Or something else) which simply returns the upload folder base.
</p>
TicketDD32Wed, 05 Mar 2008 00:29:25 GMTattachment sethttps://core.trac.wordpress.org/ticket/6097
https://core.trac.wordpress.org/ticket/6097
<ul>
<li><strong>attachment</strong>
set to <em>6097.2.diff</em>
</li>
</ul>
TicketryanWed, 05 Mar 2008 05:53:56 GMThttps://core.trac.wordpress.org/ticket/6097#comment:4
https://core.trac.wordpress.org/ticket/6097#comment:4
<p>
(In <a class="changeset" href="https://core.trac.wordpress.org/changeset/7159" title="Use wp_mkdir_p() to create js cache dir. Props DD32. see #6097">[7159]</a>) Use wp_mkdir_p() to create js cache dir. Props DD32. see <a class="closed ticket" href="https://core.trac.wordpress.org/ticket/6097" title="defect (bug): Warning&lt;/b&gt;: mkdir() [&lt;a href='function.mkdir'&gt;function.mkdir&lt;/a&gt;]: No ... (closed: fixed)">#6097</a>
</p>
TicketazaozzThu, 13 Mar 2008 20:38:53 GMTstatus changed; resolution sethttps://core.trac.wordpress.org/ticket/6097#comment:5
https://core.trac.wordpress.org/ticket/6097#comment:5
<ul>
<li><strong>status</strong>
changed from <em>new</em> to <em>closed</em>
</li>
<li><strong>resolution</strong>
set to <em>fixed</em>
</li>
</ul>
<p>
wp_mkdir_p() fixes it nicely.
</p>
Ticket