Im currently running a custom php script which when running on my localhost works fine however when running on shared hosting, i receive the following error:

> 
> Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[HY000]: General error: 2006
> 
> 
> MySQL server has gone away' in ...... 205 Stack trace:
> 
> 
> 0 ........ PDO->prepare('SELECT \* FROM o...') #1 {main} thrown in .......... on line 205
> 
> 
> 

(I've replaced the file paths with .......)

Things I have tried:

1. Adding `PDO::ATTR_TIMEOUT => "999999999999999999999"`, to extend any timeouts.
2. Checked the `max_allowed_packet` (every answer ive found says this is the cause)
My local machine is currently set to `1048576` (1mb) however my hosting is currently set to `268435456` (268mb)

I would understand if my local machine was 268mb and my hosting was 1mb but this doesn't make any sense that it is the cause of the problem, as this is not the case.

I did try to increase it on my hosting but as its shared I don't have the permissions to change this global variable.

Any other ideas of what I could try?

FYI Here is the script:

```
//MYSQL PREPARE STATEMENTS
//check to see if a product is in database
$mysql['productcheck'] = $mysql['pdo']->prepare('SELECT * FROM oc_product WHERE sku = ?');
$newproductcount=0;
$x = 0;
while(($maintable[$x]['status']=="active") || ($maintable[$x]['status']=="new") || ($maintable[$x]['status']=="discontinued") || ($maintable[$x]['status']=="archive")) {
    if(($maintable[$x]['status']=="active") || ($maintable[$x]['status']=="new")){
        //check to see if product exsists
        $params[1]=$maintable[$x]['euid'];
        $mysql['productcheck']->execute([$params[1]]);
        if($mysql['productcheck']->rowCount()==0){
            //PRODUCT DOESN'T EXSIST
            echo "Product doesnt exsists!";
            $newproductcount++;
        }
    }
$x++;
}

```