php hight load codeigniter

Discussion in 'PHP' started by applehost, Aug 17, 2012.

  1. #1
    I use on my website codeigniter, at peak times the server is very slow.

    The administrator reported that the problem comes from my index.php, but index.php would be my route from codeigniter, so the problem is elsewhere in the script.

    it said the problem is the 'PHP' and not 'mysql', I would like you to help us then to find what might be causing this problem could be a loop? there is some code that you put above and below my codes to see the total execution time?
     
    applehost, Aug 17, 2012 IP
  2. BRUm

    BRUm Well-Known Member

    Messages:
    3,086
    Likes Received:
    61
    Best Answers:
    1
    Trophy Points:
    100
    #2
    The problem is that you're using a framework. If you don't want unnecessary PHP slowing your server you should learn PHP and create what you need yourself.

    Too many people jumping into frameworks without basic programming knowledge, it's depressing to read..
     
    BRUm, Aug 18, 2012 IP
  3. prabhunimish

    prabhunimish Member

    Messages:
    15
    Likes Received:
    0
    Best Answers:
    1
    Trophy Points:
    46
    #3
    To find the total execution time, you can use the following code:

    
    $started_at = microtime(true); // place this at the top in your index.php
    
    // all code here
    
    
    // place this at the end of index.php
    $ended_at = microtime(true); 
    $time_taken = $ended_at - $started_at;
    
    
    //Uncomment the below line to output the total time taken to load the page.
    //echo 'Script execution time was '.$time_taken.' seconds';
    
    PHP:
     
    prabhunimish, Aug 18, 2012 IP