Make site faster!

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

    Make site faster!

    Is there any way to maintain my site speed. Plz post here, hw can i make my site faster to browse?

    #2
    Originally posted by sanju View Post
    Is there any way to maintain my site speed. Plz post here, hw can i make my site faster to browse?
    remove ads
    use gzip compression
    use external css files
    Advertise your mobile site for FREE with AdTwirl

    Comment


      #3
      No sql, No exec files

      No other users

      Buy a Virtual private server or go big Dedicated Servers

      Never think share hosting will always fast .......

      Also fix errors
      Visit: Chat4u.mobi - The New Lay Of being a site of your dreams!
      Visit: WapMasterz Coming Back Soon!
      _______
      SCRIPTS FOR SALE BY SUBZERO
      Chat4u Script : coding-talk.com/f28/chat4u-mobi-script-only-150-a-17677/ - > Best Script for your site no other can be hacked by sql or uploaders.
      FileShare Script : coding-talk.com/f28/file-wap-share-6596/ -> Uploader you will never regret buying yeah it mite be old now but it still seems to own others...
      _______
      Info & Tips
      php.net
      w3schools.com

      Comment


        #4
        How to enable gzip compression with Php.
        Enabling Gzip Compression

        In many forums and on many webpages it has been widely proclaimed that to enable gzip compression using php is as easy as adding a single line of code at the beginning of each page. This is not false, however it is not the best way of doing it. Before continuing, here's the code. It takes advantage of Php's buffered output and buffers all output of the script until the Php engine has completed, and then runs all the output through a special function that gzip compresses it before sending it on to the browser.

        Here is the code. Just place this at the very top of all your Php pages and it will send gzip-compressed output to the browsers.
        Code:
        <?php
            ob_start("ob_gzhandler");
        ?>
        This method is dependant on the Apache server and in addition, the mod_gzip module must be installed and loaded.
        Other Methods to Enable Gzip Compression

        The method mentioned above is quick and easy, but the downfalls are that it only works on Apache with mod_gzip. Not only that, but according to the Php manual, that is not the preferred method for gzipping.
        (From the Php manual at PHP: Hypertext Preprocessor)
        note that using zlib.output_compression is preferred over ob_gzhandler().
        Another method of gzipping is as follows:
        Code:
        <?php
        
        
        // Include this function on your pages
        function print_gzipped_page() {
        
            global $HTTP_ACCEPT_ENCODING;
            if( headers_sent() ){
                $encoding = false;
            }elseif( strpos($HTTP_ACCEPT_ENCODING, 'x-gzip') !== false ){
                $encoding = 'x-gzip';
            }elseif( strpos($HTTP_ACCEPT_ENCODING,'gzip') !== false ){
                $encoding = 'gzip';
            }else{
                $encoding = false;
            }
        
            if( $encoding ){
                $contents = ob_get_contents();
                ob_end_clean();
                header('Content-Encoding: '.$encoding);
                print("\x1f\x8b\x08\x00\x00\x00\x00\x00");
                $size = strlen($contents);
                $contents = gzcompress($contents, 9);
                $contents = substr($contents, 0, $size);
                print($contents);
                exit();
            }else{
                ob_end_flush();
                exit();
            }
        }
        
        // At the beginning of each page call these two functions
        ob_start();
        ob_implicit_flush(0);
        
        // Then do everything you want to do on the page
        echo 'Hello World';
        
        // Call this function to output everything as gzipped content.
        print_gzipped_page();
        
        
        ?>
        Last edited by riderz; 29.07.10, 15:15.
        ________________
        Jacques
        jacques@gw-designs.co.za
        http://coding.biz.tm
        Come join and lets make it a place to learn all the noobies how to code
        __________________

        NEVER FORGET TO CLICK THE TANX BUTTON IF U LIKE WHAT IM SHARING OR HELPING WITH

        Comment


          #5
          Upload this and use this
          1. at the top of your pages
          PHP Code:
          <?php
          require_once"./gzip.php";
          2. at the bottom of your pages
          PHP Code:
          require_once"./gzip_foot.php";
          ?> 
          You are Done
          Attached Files

          Comment


            #6
            wont it work if u add it to the core or config
            ________________
            Jacques
            jacques@gw-designs.co.za
            http://coding.biz.tm
            Come join and lets make it a place to learn all the noobies how to code
            __________________

            NEVER FORGET TO CLICK THE TANX BUTTON IF U LIKE WHAT IM SHARING OR HELPING WITH

            Comment


              #7
              Originally posted by riderz View Post
              wont it work if u add it to the core or config
              If you add this on your pages, it will work. Try now.
              It works for me without any errors.

              Comment


                #8
                it working both of yours but i liked riderz moving the site abit abit faster lol
                Visit: Chat4u.mobi - The New Lay Of being a site of your dreams!
                Visit: WapMasterz Coming Back Soon!
                _______
                SCRIPTS FOR SALE BY SUBZERO
                Chat4u Script : coding-talk.com/f28/chat4u-mobi-script-only-150-a-17677/ - > Best Script for your site no other can be hacked by sql or uploaders.
                FileShare Script : coding-talk.com/f28/file-wap-share-6596/ -> Uploader you will never regret buying yeah it mite be old now but it still seems to own others...
                _______
                Info & Tips
                php.net
                w3schools.com

                Comment


                  #9
                  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
                  ________________
                  Jacques
                  jacques@gw-designs.co.za
                  http://coding.biz.tm
                  Come join and lets make it a place to learn all the noobies how to code
                  __________________

                  NEVER FORGET TO CLICK THE TANX BUTTON IF U LIKE WHAT IM SHARING OR HELPING WITH

                  Comment


                    #10
                    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
                    yeah......I used It for one of my client pages. It Works faster And its not needed any xtra handler from server side.
                    But I surprised to see that its not work faster for php-wml.:O

                    Comment


                      #11
                      basic is only use php when needed as this is the most server consuming proccess. only connect to the server when needed ie if your going to look up a query bladi blah otherwise just stik to plain html as the browser will do all the work then not the server.
                      Want something coded email me at sales@webnwaphost.com for a prices.




                      Comment


                        #12
                        Originally posted by sanju View Post
                        Is there any way to maintain my site speed. Plz post here, hw can i make my site faster to browse?
                        Send me your data base users tables and i will make you a cool script for you to use so your site will run 10% faster and cleaner that is a hope it does but lets try it ..

                        Names not the sql ok

                        like

                        ibf_users
                        ibf_posts

                        type all down for me then i will do this simple code for you to use with corn
                        Visit: Chat4u.mobi - The New Lay Of being a site of your dreams!
                        Visit: WapMasterz Coming Back Soon!
                        _______
                        SCRIPTS FOR SALE BY SUBZERO
                        Chat4u Script : coding-talk.com/f28/chat4u-mobi-script-only-150-a-17677/ - > Best Script for your site no other can be hacked by sql or uploaders.
                        FileShare Script : coding-talk.com/f28/file-wap-share-6596/ -> Uploader you will never regret buying yeah it mite be old now but it still seems to own others...
                        _______
                        Info & Tips
                        php.net
                        w3schools.com

                        Comment


                          #13
                          1. One good thing your could do would be to use PHP Data Objects (PDO) to interface with MySQL; The php mysql_ functions over 6+ years out of date. PDO is Cross Database meaning you could use different related databases: Cubrid, Microosoft SQL, Firebird, Interbase, IBM, Informix, MySQL, Oracle, ODCB, 4D, SQL-Lite, PostgreSQL using the built in drivers. It also Provides Extra SQL Injection Prevention. Caches frequently used queries that can be re-used without being recompiled by the processor.

                          2. Limiting the number of Queries that your script needs to do could be another way to speed up page execution time. If there are sections of your script that use multiple MySQL Selects to the same table why not select if all at once.

                          3. You might also consider caching information that does not change very often. For example User Settings and Profile Information should only need refreshing if the users updates them. You should only need to select this once then update and refres on a new login or profile update.

                          4. Move your site to a Dedicated Server this way you have your own dedicated space. The more popular your site gets the more it will slow down; This is because more server resources are being used up by other users on the same server your are being hosted on. When you go dedicated there are no other users. This gives you Dedicated RAM, Bandwidth, Space and you can use the resources that you require. There are a lot more advantages to dedicated hosting but that is another discussion.

                          5. Moving your site to a Virtual Private Server (VPS) this is usually a partion of a dedicated server. You can do pretty much what you can do with a dedicated server but prices can be a lot cheaper.

                          6. Use of bitwise to store on and off settings (32 settings for each and every digit), Remove un-needed stuff from the database tables. Only use PHP if it is needed. Output Buffering (Can also be stacked), Caching systems, Gzip Compression, Load Balancing, Optimization of Site Graphics, CSS and HTML Markup Validation and optimisation/compression.
                          Last edited by wap2k; 09.02.11, 04:42.

                          Comment


                            #14
                            Pdo is not a database. Its a layer to interact with the database.
                            Perfection comes at a cost



                            I accept liberty!

                            Comment


                              #15
                              Thanks... I already knew that . That was written when i was tired i have corrected a couple of mistakes.

                              Comment

                              Working...
                              X