Thursday, November 18, 2010

Solution: You don't have permission to access / on this server

Encounter this problem after you set up virtual host in web server?
It is because the folder permission is not set probably.

Here is an example:


<Virtualhost *:80="">
ServerName testhost.com
DocumentRoot "/home/testhost/www"
DirectoryIndex index.php
<Directory "/home/testhost/www">
AllowOverride All
Allow from All
</Directory>


ErrorLog "logs/testhost-error.log"
CustomLog "logs/testhost-access.log" common
</Virtualhost>

Make sure to set permission 755 for each folder in the document root path
/home <- 755
/home/testhost <-- 755
/home/testhost/www <-- 755

Thursday, November 11, 2010

Custom error500 / 400 page in symfony 1.4

Custom 400 page:

In config/settings.yml,
all:
  .actions:
    error_404_module:       error
    error_404_action:       404

Then when a page is not found, it will forward to "<your_domain>/error/404".

Custom 500 page:

1. Create "error" folder under "config"
2. create "error.html.php" under "config/error"

Monday, November 1, 2010

Solution: route has some missing mandatory parameters

This time I encountered an error in symfony, I set a new route and got this error.
The route is like this:

new_page:
  url: /new/page/:id
  param: {module: page, action: new}
  requirements:
    id: \d+

How to fix?
1. Add a default value.


new_page:
  url: /new/page/:id
  param: {module: page, action: new, id: 0}
  requirements:
    id: \d+


2. Check if you used any routing functions like url_for2() that missing the input parameter.