Jump to content

Fixed problem with REST service PUT method on Apache with FastCGI PHP


Recommended Posts

We experienced problems using the PUT method on one of our customers' servers while trying to update category data with the PrestShop REST api.
Although all credentials where correctly setup we got the message

'403 Forbidden - You dont have the permission blablabla'

On our development server we did not have this issue.
After spending some time trying to find the location where it went wrong we ended up in the dispatcher.php file. 
The problem ocurred int these lines
// if a XML is in PUT or in POST

    while ($putData = fread($putresource, 1024))     // <== The while loop failed

        $input_xml .= $putData;
Changing these lines into the ones as shown below solved the problem.
// if a XML is in PUT or in POST

    while (!feof($putresource )) {
        $input_xml .= fread($putresource, 1024);
Having a chat with the hosting provider learned that it probably has something to do with the combination of Apache and PHP using FastCGI and maybe the PHP version (5.4)
Hope this info is useful for others.

Kind regards,

Edited by sooi65 (see edit history)
  • Like 1
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...