MVC Framework routing all requests through index.php - performance

Posted on 2006-06-02
Medium Priority
Last Modified: 2008-02-26
I'm currently developing a new MVC framework for projects in my company.  I'm a little new to MVC (Model View Controller) and have a question.   Is there any performance consequences by routing all url requests through a single index.php script?  For example, and requests to mydomain.com would go through mydomain.com/index.php.  Example requests could be mydomain.com/articles/show or mydomain.com/blog/add.

The index.php script would initialize the main controller which would then call the appropriate controller class to handle the request.
Question by:purfus
LVL 10

Accepted Solution

ClickCentric earned 750 total points
ID: 16819926
It depends on what you're rating it in comparison to?  Just individual php files?  There shouldn't be.  As long as 'index.php' is written well enough to only load the common shared code before loading in the appropriate code for the specific page, it should be just as fast as going to an individual php file which basically has to do the same thing.  There would be a 'slight' difference since index.php has to load and then load the other php file, but depending on the machine it's running on, the difference should be between nanoseconds and microseconds.
LVL 11

Assisted Solution

neester earned 750 total points
ID: 16823702
There shouldnt be any issues with that at all.
The PHP script is irrelevant, the php binary is what runs the script...

On windows the php.exe is what interprets the .php files.
If wouldnt make a difference if you had 20 files or just 1...
Unless that 1 file is uber inefficent... the coding of that file is what would cause issues.

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
The title says it all. Writing any type of PHP Application or API code that provides high throughput, while under a heavy load, seems to be an arcane art form (Black Magic). This article aims to provide some general guidelines for producing this typ…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
Suggested Courses
Course of the Month15 days, 18 hours left to enroll

850 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question