Support » Fixing WordPress » Visual Editor & TinyMCE Problems with 2.5 – Check realpath() works

  • After going through the suggestions in the following threads, I still had a problem with the tinyMCE editor.

    WP 2.5 – WYSIWIG Problem – TinyMCE does not start..
    2.5 and TinyMCE not working in visual mode
    Visual Editor Not Working on Upgrade
    2.5 Visual Editor/TinyMCE problems

    Inspecting the code versus the output of the tiny_mce_config.php I noticed that the javascript files (tiny_mce_ext.js and tiny_mce.js) were not being added to the response. Which in turn caused the tinyMCEPreInit.start() to raise an error and the HTML editor to stop working.

    On our shared server the function realpath() existed, but was returning a boolean false. This messed up the rest of the code in the function getFileContents($path). Temporarily commenting out the first 2 lines of the function fixed the problem:
    `if ( function_exists(‘realpath’) )
    $path = realpath($path);`

    After running some simple tests, it was found realpath() was not working anywhere on our server so I contacted our server’s support and they found the problem. One of the higher level directories did not have the permissions set correctly which caused realpath() to always return False.

    I’ve now reverted back to the original code and it works fine, but suggest that the following code be used in future tinyMCE versions.

    `if ( function_exists(‘realpath’) && ($newpath = realpath($path)) )
    $path = $newpath;`

    I hope this helps someone out there.

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


    It helped me 😉

    I’ve tried every possible solution and combination, in other posts. I could see that the getfilecontents would not work, but could not imagine realpath was broken.

    just for the records your piece of code works like a charm.



    On further investigation i stumbled upon this post:

    Thanks EmmPee,

    That gave me a partial fix. All I could see were the Visual & HTML tabs but no buttons except for Add Media buttons above. I now have only the HTML buttons on the Visual tab and the Media buttons above.

    Nothing happens when I click on the HTML tab. It’s dormant.

    I have vers 2.6.1.- A new install, not an upgrade. Have checked (twice) all the files in the TinyMCE folder and all appear to have been uploaded properly.

    Any suggestions?

    is there another editor I can use instead?

    I’ve now installed FCKEditor from the Word Press extensions

    It’s working with WP 2.6.1. It’s working fine except for insertion of images ‘though I think that can be sorted.

    I had the same problems even with the latest WP version.

    Eventually I observed that my web-server would not server the file
    tiny_mce_config.php (document not found) yet other files in the same directory were visible. (Ownership and permissions were all the same.)

    The only difference I could see was that the file had a longer name than any of the others! I renamed the tiny_mce_config.php to t_m_conf.php to see if the file would behave. Sure enough it did!

    So I searched for the tiny_mce_config.php references in all the php files and found just one occurrence in each of
    wp-admin/gears-manifest.php and wp-includes/script-loader.php so that these could be changed to the new filename – a total of two minor edits!

    Job done. Everything now works as it should. So it looks as if it may be a long filename problem on some web-server implementations.

    I hope this may help someone else avoid the long journey through all the posts that have gone before.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Visual Editor & TinyMCE Problems with 2.5 – Check realpath() works’ is closed to new replies.