我的PHP脚本有一个小问题。本例使用Magento API,并尝试为产品创建媒体。
$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));
当我用一个小图像(大约10k, 100x100像素)运行这个脚本时,一切都很好,但是当我尝试使用一个大图像(140k, 500x500像素)时,soap返回这个错误:
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}
我的想法是,长度,当它是一个大的图像,base64_encode(file_get_contents($product_image_url))太大,然后Soap失败。
也许Apache或PHP配置文件?
Santerref .
是的,很可能是PHP或Apache导致了这个错误。检查Apache error_log是否有线索。一些可能的PHP配置选项:
- max_execution_time
- memory_limit
- post_max_size
- upload_max_filesize