Make site faster!

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    #16
    :D. All in all, you have some valid points there.

    Usind prepared statements with pdo will speed up your script and also help prevent injection attacks, only if you use them well. Also help with multiple queries.

    Gzip compression is also great for speeding up delivery to the browser, but can use resources.

    Splitting your tables can help a great deal like, separating users from their settings and profiles.

    There's just soooo much, you will learn as you go along, just be willing to learn.
    Perfection comes at a cost



    I accept liberty!

    Comment


      #17
      Originally posted by riderz View Post
      Caching database-driven PHP pages is an excellent idea to improve the load and performance of your script. It’s really not all that difficult to create and retrieve static files of content with the help of our good friend ob_start().
      Code:
      // TOP of your script  
      $cachefile = 'cache/'.basename($_SERVER['SCRIPT_URI']);  
      $cachetime = 120 * 60; // 2 hours  
      // Serve from the cache if it is younger than $cachetime  
      if (file_exists($cachefile) && (time() - $cachetime < filemtime($cachefile))) {  
      include($cachefile);  
      echo "<!-- Cached ".date('jS F Y H:i', filemtime($cachefile))." -->";  
      exit;  
      }  
      ob_start(); // start the output buffer  
      // Your normal PHP script and HTML content here  
      // BOTTOM of your script  
      $fp = fopen($cachefile, 'w'); // open the cache file for writing  
      fwrite($fp, ob_get_contents()); // save the contents of output buffer to the file  
      fclose($fp); // close the file  
      ob_end_flush(); // Send the output to the browser
      Just now I read this !
      Very nice .. but not good ideea for sites who serve ads between content .. :-S
      Unamos los corazones,hoy todos somos multicolores!

      Comment

      Working...
      X