NYCPHP Meetup

NYPHP.org

[nycphp-talk] Performance testing on Windows Server 2008 & MySQLi performance hit

Daniel Convissor danielc at analysisandsolutions.com
Tue Jul 3 16:32:33 EDT 2012


Hi Woh:

> 2) Part of the reason for upgrading is that the application has taken a
> HUGE hit in performance after we updated mysql connections to mysqli and
> moved most of the php files above the web root folder.

The way files are included can be a significant performance issue.

It's best to use full, true, paths when including files.  One strategy
I've used is having all scripts include one central config file via a
relative path.  Then in that script do this:

define('PATH_BASE', realpath(dirname(__FILE__));

Then all other includes/requires in the application should do:

require PATH_BASE . '/subdir/whatever/some_other_file.php'

This removes the need to use the include_path and simplifies the
operations PHP needs to do for caching file names and paths.

Also, carefully consider the order of entries in the include_path
setting.  Put the directories in there in order of most used first,
least used last.

--Dan

-- 
 T H E   A N A L Y S I S   A N D   S O L U T I O N S   C O M P A N Y
            data intensive web and database programming
                http://www.AnalysisAndSolutions.com/
        4015 7th Ave #4, Brooklyn NY 11232  v: 718-854-0335



More information about the talk mailing list