Web pages load slowly

From ShawnReevesWiki
Jump to navigationJump to search

A list of problems that cause(d) web pages on my servers to load slowly, and, if available, their solutions.

SESSION variables

A couple months ago, I noticed that my "authenticated" pages loaded more slowly, or not at all, compared to the public pages at http://energyteachers.org . Today, I was programming a page to get information through the server from a previous page, and I discovered the problem was related to session variables.

Now I know to use session_save_path() before declaring a session in PHP so that session variables are stored in my own folder instead of the same folder the hundreds of other sites on my shared server use. The pages went from zero to zippy.

You don't need to know the absolute path, just the relative path from the path you're in, to a tmp folder. To get the path you're in, get the DOCUMENT_ROOT variable from the server. For example: session_save_path($_SERVER['DOCUMENT_ROOT'].'/tmp');

Internal MySQL names

Network Solutions gives us MySQL databases with IP addresses but also trick internal aliases that their PHP interpreter routes more quickly than it can IP addresses. However, Dreamweaver borks if it doesn't have the IP address while developing pages with those databases. The solution is to upload a version of Connections with aliases to the server, while keeping a version of Connections with IP addresses on our computer for developing.