PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Monday, February 14, 2022

[FIXED] Issue getting CakePHP to work on MAMP in virtual host

 February 14, 2022     apache, cakephp, mamp, php, virtualhost     No comments   

Issue

I dont know how to get CakePHP to run in a virtual host on my local machine. I can get the code to work on the default http://localhost:8888/caketest/ but cant get it to work from http://cakeapp.local:8888/ where I get the warning

"URL rewriting is not properly configured on your server.   1) Help me configure it 2) I don't / can't use URL rewriting"

In MAMP's httpd.conf I added

<VirtualHost *>
    DocumentRoot "/Applications/MAMP/htdocs"
    ServerName localhost
</VirtualHost>
<VirtualHost *>
    DocumentRoot "/Users/me/Documents/path/to/root/root"
    ServerName cakeapp.local
</VirtualHost>

I saw in the help page that it expects

Options FollowSymLinks
AllowOverride All
# Order deny,allow
# Deny from all

but this crashed MAMP

both are CakePHP 2.4.9 with no changes to the default download

Edit: The not working files in /Users/me/Documents/path/to/root/root which dont work were copied to /Applications/MAMP/htdocs where they then worked, so it is an issue with the virtual host

Edit 2: I thought I had found a solution but It looks like I was wrong. I changed the virtual host to point directly to /app/webroot which has made the default page show correctly, I then proceeded to add the DebugKit plugin (which I have working in a different local host file and the rewrites for its files still dont work.

For example app/Plugin/DebugKit/webroot/css/debug_toolbar.css gets loaded on http://localhost:8888/caketest/debug_kit/css/debug_toolbar.css but the file in the virtual host http://cakeapp.local:8888/debug_kit/css/debug_toolbar.css returns a 404 error (the plugin works), the files just dont get loaded.


Solution

OK, I think this works, the last time I tried to fix the directory it was not pointing at the correct directory.

I added the following to the httpd.conf:

<Directory "/Users/me/Documents/path/to/root/root">
    Options All
    AllowOverride All
    Order allow,deny
    Allow from all
</Directory>


Answered By - Totoro
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing