If you have to rename your CakePHP root folder for some reason, you might come across HTTP 500 Internal Server Error. This generally happens because of PHP opcode caching done by PHP accelerators for performance boosts.

The problem can usually be fixed by restarting your server. If not, you might have to clear the PHP opcode cache manually.

Clearing PHP opcode cache in XCache
Clearing PHP opcode cache in XCache

If you’re using MAMP (or MAMP Pro) on a Mac, which comes bundled with XCache, you can easily fix it by visiting XCache tab from server start page and using the clear button against the PHP cache. If you have a different PHP dev setup, check for other PHP accelerators like APC or eAccelerator.

This will fix your problem and your CakePHP app will continue to function normally after renaming the CakePHP root directory.

One thought on “Fix HTTP 500 Internal Server Error on renaming CakePHP root directory

  1. Forgive my English (translated by Google). I need help.

    I downloaded CakePHP, unzipped the contents into a folder also called cakephp and put in localweb, getting access URL:
    http://127.0.0.1/cakephp/

    This URL gives me access to the cake home screen where it gives me the initial connection information , rewrite, etc.

    In a second step I made a copy of the app folder and rename the original and the copy for test1 and test2 respectively.

    At this time it was only possible to see the cited page through URL ‘s:

    http://127.0.0.1/cakephp/teste1

    and

    http://127.0.0.1/cakephp/teste2

    However this behaviour is not repeated in online hosting ( uolhost ) .

    When copying the same files to the web folder ( public site files ) and access the URL http://www.site.com.br/cakephp/teste1 I see the following error: “CakephpController could not be found.”

    In an attempt to make him understand he should demand from ” cakephp ” and that this was not a error made ​​this change:

    Router :: connect (' / cakephp / ', array ( 'controller' = > 'pages' , 'action' = > 'display' , ' home') ) ;

    but got no result. The cake kept thinking that cakephp is a controller who disappeared …

    What can I do to get it online , the same local behavior ?

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.