I have a little problem with my PHP script. This one use the Magento API and try to create a media for a product.
$imageData = array(
'file' => array(
'name' => 'myimage.jpg',
'content' => base64_encode(file_get_contents($product_image_url)),
'mime' => 'image/jpeg'
),
'label' => 'Product Image #4',
'position' => 1,
'types' => array('small_image','image','thumbnail'),
//'types' => array('image'),
'exclude' => 0
);
$image_create = $client->call($sessID, 'product_media.create', array($product_id, $imageData));
$client->call($sessID, 'product_media.update', array($product_id, $image_create));
When I run this script with a little image (about 10ko, 100x100 pixels), everything works fine, but when I try with a large image (140k, 500x500 pixels) soap return this error :
SoapFault exception: [HTTP] Internal Server Error in /var/www/vhosts/domain.com/httpdocs/test_update.php:46 Stack trace: #0 [internal function]: SoapClient->__doRequest('__call('call', Array) #2 /var/www/vhosts/domain.com/httpdocs/test_update.php(46): SoapClient->call('068bd88e8f56261...', 'product_media.c...', Array) #3 {main}
My idea is that the length, when it's a large image, of base64_encode(file_get_contents($product_image_url)) is too big and then Soap fail.
Maybe Apache or PHP conf file?
Santerref.
Yes, it's very likely that PHP or Apache is causing this error. Check your Apache error_log for any clues. Some possible PHP configuration options: