Buying Need help with Server configuration for PDO site

Discussion in 'Programming' started by readezarchive, Jun 10, 2015.

  1. #1
    Hello I just recently converted a site to PDO and started having server issues right afterwards. The previous mysql queries were outdated and presented XSS/SQL-injection vulnerabilities, so I had a developer convert it to PDO.

    The site will run fine for a few hours then users will get errors like:

    SQLSTATE[HY000] [2002] no such file or directory
    Code (markup):
    Warning: PDO::query(): MySQL server has gone away in footer.php on line 50
    Code (markup):
    Warning: PDO::query(): Error reading result set's header in footer.php on line 50
    Code (markup):
    Fatal error: Call to a member function fetchAll() on a non-object in index.php on line 75
    Code (markup):
    At the moment there's not much choice other than to reboot the server and it will run fine for a few more hours.

    Here are the current settings in my.cnf:

    [mysqld]
    default-storage-engine=MyISAM
    innodb_file_per_table=1
    max_allowed_packed=100M
    max_connections=500
    log_error=/var/log/mysql.log
    log-slow-queries=/var/log/mysql-slow.log
    [mysqld_safe]
    log_error=/var/log/mysql.log
    Code (markup):
    When I check the server stats, the Ram and CPU are almost at max capacity like 90+ %. Before the site was converted to PDO, it could handle 2-3 times the traffic no problem, but I was told PDO would be more secure and faster.

    PHP.ini settings:

    memory_limit = 1024M
    post_max_size = 8M
    default_socket_timeout = 60
    mysql.connect_timeout = 300
    mysql.default_socket= 300
    max_execution_time = 1000
    max_input_vars = 5000

    Need someone to help me get this site running faster, smoother and most importantly STABLE. If you are an expert at server and script optimization please contact me. info @ enterscope.com or PM
     
    Last edited: Jun 10, 2015
    readezarchive, Jun 10, 2015 IP
  2. Anveto

    Anveto Well-Known Member

    Messages:
    697
    Likes Received:
    40
    Best Answers:
    19
    Trophy Points:
    195
    As Seller:
    100% - 0
    As Buyer:
    100% - 0
    #2
    Anveto, Jun 10, 2015 IP
  3. cLogik

    cLogik Active Member

    Messages:
    159
    Likes Received:
    28
    Best Answers:
    0
    Trophy Points:
    90
    As Seller:
    100% - 0
    As Buyer:
    100% - 1
    #3
    Increasing the timeout is not the solution. This is a poorly written script that runs in a loop and crashes, most likely it never ends the processes it creates. Contact me if you need any assistance.
     
    cLogik, Jun 13, 2015 IP
  4. readezarchive

    readezarchive Active Member

    Messages:
    600
    Likes Received:
    10
    Best Answers:
    0
    Trophy Points:
    80
    As Seller:
    100% - 0
    As Buyer:
    100% - 1
    #4
    It looks like it was a problem with hosting multiple sites on the same VPS. Another site's cron jobs were overloading the resources at certain times.
     
    readezarchive, Jun 26, 2015 IP