Jump to content

WebServer error 500 inserting product


WMNC

Recommended Posts

A couple days ago I moved my shop from a shared hosting to a dedicated VPS. Everything works fine but I'm having some problems with the WebService (I created a web application that my suppliers use to add products to my shop - after my approval). Before the moving it worked seamlessly for a couple of years.

Now every time I insert a new product I get a frustrating error 500 in the webserver response.

This call to PrestaShop Web Services failed and returned an HTTP status of 500. That means: Internal Server Error.

The strange thing is that when I enable _PS_MODE_DEV_ in defines.inc.php the error disappears and the insert procedure works fine so I'm unable to debug it.

There isn't any error related to this in php error logs.

How can I solve this issue?

Thanks in advance

Link to comment
Share on other sites

A couple days ago I moved my shop from a shared hosting to a dedicated VPS. Everything works fine but I'm having some problems with the WebService (I created a web application that my suppliers use to add products to my shop - after my approval). Before the moving it worked seamlessly for a couple of years.

Now every time I insert a new product I get a frustrating error 500 in the webserver response.

This call to PrestaShop Web Services failed and returned an HTTP status of 500. That means: Internal Server Error.

The strange thing is that when I enable _PS_MODE_DEV_ in defines.inc.php the error disappears and the insert procedure works fine so I'm unable to debug it.

There isn't any error related to this in php error logs.

How can I solve this issue?

Thanks in advance

Did you checked the permissions? Most probably this is the issue

Link to comment
Share on other sites

Did you checked the permissions? Most probably this is the issue

 

Only for testing purposes I gave the whole website folder (and subdirectories) full permissions but that didn't solve the problem.

How can the _PS_MODE_DEV_ solve the issue?

Link to comment
Share on other sites

  • 2 weeks later...

Check the error logs from error_log and also from your hosting control panel

 

I cleared all the error logs, restarted apache and repeated the product insert procedure several times but there isn't any error. I don't have an hosting control panel because I'm using a dedicated VPS. I checked "/var/log/httpd", "mydomain.com/error.log" and "/var/log/php_scripts.log" are there any other log to check?

Edited by WMNC (see edit history)
Link to comment
Share on other sites

I cleared all the error logs, restarted apache and repeated the product insert procedure several times but there isn't any error. I don't have an hosting control panel because I'm using a dedicated VPS. I checked "/var/log/httpd", "mydomain.com/error.log" and "/var/log/php_scripts.log" are there any other log to check?

 

maybe this helps, but if you cannot get reason behind  500,  all is lost.

 

It's most likely a mod_security error.....

 

http://blog.codeasite.com/how-do-i-find-apache-http-server-log-files

Link to comment
Share on other sites

maybe this helps, but if you cannot get reason behind  500,  all is lost.

 

It's most likely a mod_security error.....

 

http://blog.codeasite.com/how-do-i-find-apache-http-server-log-files

 

Sadly it didn't solve the problem.

I tried updating PSWebServiceLibrary.php, cleared Smarty compile cache with no result.

The product is inserted and all the fields are correct but it still throws the error.

This call to PrestaShop Web Services failed and returned an HTTP status of 500. That means: Internal Server Error.
Link to comment
Share on other sites

 

Sadly it didn't solve the problem.

I tried updating PSWebServiceLibrary.php, cleared Smarty compile cache with no result.

The product is inserted and all the fields are correct but it still throws the error.

This call to PrestaShop Web Services failed and returned an HTTP status of 500. That means: Internal Server Error.

 

you must find the  php error log on hosting to get underlying error code.

 

if you cannot get this information then you should change hosting plan

Edited by El Patron (see edit history)
Link to comment
Share on other sites

This is the result of the last test in debug mode. If I enable _PS_MODE_DEV_ the error disappears. In both cases the product is inserted correctly.

HTTP REQUEST HEADER
GET /api/products?schema=blank HTTP/1.1
Authorization: Basic [...]
Host: www.negozioclick.it
Accept: */*

HTTP RESPONSE HEADER
HTTP/1.1 200 OK
Date: Wed, 19 Oct 2016 10:07:49 GMT
Server: Apache
Vary: Authorization
X-Powered-By: PrestaShop Webservice
Access-Time: 1476871669
PSWS-Version: 1.6.1.4
Execution-Time: 0.015
Content-Sha1: 86d60ce8c17274269df7e52826c169148844eca4
Set-Cookie: [...]; expires=Tue, 08-Nov-2016 10:07:49 GMT; path=/; domain=[...]; secure; httponly
Content-Length: 3008
Content-Type: text/xml;charset=utf-8
RETURN HTTP BODY
<?xml version="1.0" encoding="UTF-8"?>
<prestashop xmlns:xlink="http://www.w3.org/1999/xlink">
<product>
	<id></id>
	<id_manufacturer></id_manufacturer>
	<id_supplier></id_supplier>
	<id_category_default></id_category_default>
	<new></new>
	<cache_default_attribute></cache_default_attribute>
	<id_default_image></id_default_image>
	<id_default_combination></id_default_combination>
	<id_tax_rules_group></id_tax_rules_group>
	<position_in_category></position_in_category>
	<type></type>
	<id_shop_default></id_shop_default>
	<reference></reference>
	<supplier_reference></supplier_reference>
	<location></location>
	<width></width>
	<height></height>
	<depth></depth>
	<weight></weight>
	<quantity_discount></quantity_discount>
	<ean13></ean13>
	<upc></upc>
	<cache_is_pack></cache_is_pack>
	<cache_has_attachments></cache_has_attachments>
	<is_virtual></is_virtual>
	<on_sale></on_sale>
	<online_only></online_only>
	<ecotax></ecotax>
	<minimal_quantity></minimal_quantity>
	<price></price>
	<wholesale_price></wholesale_price>
	<unity></unity>
	<unit_price_ratio></unit_price_ratio>
	<additional_shipping_cost></additional_shipping_cost>
	<customizable></customizable>
	<text_fields></text_fields>
	<uploadable_files></uploadable_files>
	<active></active>
	<redirect_type></redirect_type>
	<id_product_redirected></id_product_redirected>
	<available_for_order></available_for_order>
	<available_date></available_date>
	<condition></condition>
	<show_price></show_price>
	<indexed></indexed>
	<visibility></visibility>
	<advanced_stock_management></advanced_stock_management>
	<date_add></date_add>
	<date_upd></date_upd>
	<pack_stock_type></pack_stock_type>
	<meta_description><language id="1"></language></meta_description>
	<meta_keywords><language id="1"></language></meta_keywords>
	<meta_title><language id="1"></language></meta_title>
	<link_rewrite><language id="1"></language></link_rewrite>
	<name><language id="1"></language></name>
	<description><language id="1"></language></description>
	<description_short><language id="1"></language></description_short>
	<available_now><language id="1"></language></available_now>
	<available_later><language id="1"></language></available_later>
<associations>
<categories>
	<category>
	<id></id>
	</category>
</categories>
<images>
	<image>
	<id></id>
	</image>
</images>
<combinations>
	<combination>
	<id></id>
	</combination>
</combinations>
<product_option_values>
	<product_option_value>
	<id></id>
	</product_option_value>
</product_option_values>
<product_features>
	<product_feature>
	<id></id>
	<id_feature_value></id_feature_value>
	</product_feature>
</product_features>
<tags>
	<tag>
	<id></id>
	</tag>
</tags>
<stock_availables>
	<stock_available>
	<id></id>
	<id_product_attribute></id_product_attribute>
	</stock_available>
</stock_availables>
<accessories>
	<product>
	<id></id>
	</product>
</accessories>
<product_bundle>
	<product>
	<id></id>
	<quantity></quantity>
	</product>
</product_bundle>
</associations>
</product>
</prestashop>
HTTP REQUEST HEADER
POST //api/products HTTP/1.1
Authorization: Basic [...]
Host: [...]
Accept: */*
Content-Length: 1822
Content-Type: application/x-www-form-urlencoded

HTTP RESPONSE HEADER
HTTP/1.1 500 Internal Server Error
Date: Wed, 19 Oct 2016 10:07:49 GMT
Server: Apache
Vary: Authorization
X-Powered-By: PrestaShop Webservice
Access-Time: 1476871669
PSWS-Version: 1.6.1.4
Execution-Time: 0.156
Set-Cookie: [...]; expires=Tue, 08-Nov-2016 10:07:49 GMT; path=/; domain=[...]; secure; httponly
Content-Length: 354
Connection: close
Content-Type: text/xml;charset=utf-8
XML SENT
<?xml version="1.0" encoding="UTF-8"?>
<prestashop xmlns:xlink="http://www.w3.org/1999/xlink">
<product>
	<id/>
	<id_manufacturer></id_manufacturer>
	<id_supplier>22</id_supplier>
	<id_category_default>2</id_category_default>
	<new/>
	<cache_default_attribute/>
	<id_default_image/>
	<id_default_combination/>
	<id_tax_rules_group>1</id_tax_rules_group>
	
	<type/>
	<id_shop_default/>
	<reference>NC_0RWD</reference>
	<supplier_reference/>
	<location/>
	<width/>
	<height/>
	<depth/>
	<weight>1</weight>
	<quantity_discount/>
	<ean13/>
	<upc/>
	<cache_is_pack/>
	<cache_has_attachments/>
	<is_virtual/>
	<on_sale/>
	<online_only/>
	<ecotax/>
	<minimal_quantity>1</minimal_quantity>
	<price>22.300000</price>
	<wholesale_price>15.800000</wholesale_price>
	<unity/>
	<unit_price_ratio/>
	<additional_shipping_cost/>
	<customizable/>
	<text_fields/>
	<uploadable_files/>
	<active>0</active>
	<redirect_type>404</redirect_type>
	<id_product_redirected/>
	<available_for_order>1</available_for_order>
	<available_date/>
	<condition/>
	<show_price>1</show_price>
	<indexed/>
	<visibility/>
	<advanced_stock_management/>
	<date_add/>
	<date_upd/>
	<pack_stock_type>3</pack_stock_type>
	<meta_description><language id="1"/></meta_description>
	<meta_keywords><language id="1"/></meta_keywords>
	<meta_title><language id="1"/></meta_title>
	<link_rewrite><language id="1">nome-prodotto</language></link_rewrite>
	<name><language id="1">nome_prodotto</language></name>
	<description><language id="1">descrizione_prodotto</language></description>
	<description_short><language id="1"></language></description_short>
	<available_now><language id="1"/></available_now>
	<available_later><language id="1"/></available_later>
<associations><categories><category><id>2</id></category></categories></associations>
</product>
</prestashop>
RETURN HTTP BODY
<?xml version="1.0" encoding="UTF-8"?>
<prestashop xmlns:xlink="http://www.w3.org/1999/xlink">
<errors>
<error>
<message><![CDATA[Internal error. To see this error please display the PHP errors.]]></message>
</error>
<error>
<message><![CDATA[Internal error. To see this error please display the PHP errors.]]></message>
</error>
</errors>
</prestashop>
Edited by WMNC (see edit history)
Link to comment
Share on other sites

you must find the  php error log on hosting to get underlying error code.

 

if you cannot get this information then you should change hosting plan

Hi, sorry for confusion on my part, but have you located your apache error log from hosting?  Can you contact your hosting company to help you  get the actual error?

 

As I said before I'm currently using a dedicated CentOS 7 VPS and I have full access to all logs but this error isn't in any of them. If I enable _PS_MODE_DEV_ the error disappears. In both cases the product is inserted correctly.

Edited by WMNC (see edit history)
Link to comment
Share on other sites

  • 3 years later...

hola, he seguido este hilo y tengo el mismo problema, en mi caso pude verificar el error:

Fatal error:  Uncaught exception 'PrestaShop\PrestaShop\Core\Localization\Exception\LocalizationException' with message 'Price specification not found for currency: ""' in /home/ventasweb/public_html/src/Core/Localization/Locale.php:171

les agradezco su ayuda

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...