MVC Framework routing all requests through index.php - performance

Posted on 2006-06-02
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 would go through  Example requests could be or

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

    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

    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

    What Security Threats Are You Missing?

    Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

    Join & Write a Comment

    Foreword (July, 2015) Since I first wrote this article, years ago, a great many more people have begun using the internet.  They are coming online from every part of the globe, learning, reading, shopping and spending money at an ever-increasing ra…
    Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
    Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
    The viewer will learn how to count occurrences of each item in an array.

    728 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

    Need Help in Real-Time?

    Connect with top rated Experts

    20 Experts available now in Live!

    Get 1:1 Help Now