Jump to content

Problems accessing database after reading xml file


Recommended Posts

Hello,

 

I am programming a PHP script: when loading external xml file with simplexml_load_file(), if the xml file is not very light: for example 3934 product references (2,5 MB), I can not access my Prestashop database to import those product references: functions executeS, insert, …from Prestashop class Db.php. These functions only work correctly if the xml file is much lighter: for example 95 product references. (I do not import images yet).

                                   

The problem could be related to memory issues??? I have set with php.ini memory_limit to values as 64 M, 128 M, 256 M…As well as the parameters: post_max_size, upload_max_filesize. I have set max_execution_time and max_input_time to 0. But the problem still continues. I have changed many times the code, but I do not know if it is a code problem o server requirements problem…

                                                         

Could you give me any help please?

 

The code is like:

 

$filexml=simplexml_load_file('http://serverexterno.es/archivo.xml');

 

$username = "user";

$password = "passwd";

$hostname = "miservidor.com";

//Conexi??on la base de datos

 

$mysqli = new mysqli($hostname, $user, $passwd);

 

/* check connection */

if (mysqli_connect_errno()) {

    echo "Conexion error";

    exit();

}

 

echo "Connected to MySQL";

 

echo "<br>";

 

//Instructions to access and insert in Prestashop database like:

 

$sql = 'SELECT * FROM `'._DB_PREFIX_.'customer` WHERE `birthday`=("1970-01-15")';

$resultado = Db::getInstance()->executeS($sql);

echo "<br>";

var_dump($resultado);

 

-> bool (false)

 

Thanks,

Link to comment
Share on other sites

×
×
  • Create New...