Getting 500 Internal Server Error with Stripe - php

I am trying to implement basic functionality of the Stripe API, I get 500 Internal Server Error for some reason when I require the Stripe.php file that you have to require...When I comment the require out the error goes away but obviously I can not use the API then..
Basic require...shows error in the Modal Log
require_once('/php/Stripe.php');
I checked the server error and it gave me this back
Fatal error: Uncaught exception 'Exception' with message 'Stripe needs the Multibyte String PHP extension.' in /php/Stripe.php:13 Stack trace: #0 /home/stripepost.php(4): require_once() #1 {main} thrown in /php/Stripe.php on line 13
This all comes from just requiring the file..

Is your 'Stripe.php' file really located in '/php' or is it in a folder called 'php' local to your code?
Current code:
require_once('/php/Stripe.php');
I think the problem is this. You probably mean to use something relative to your code base. Like this:
require_once('./php/Stripe.php');

I found out the answer I didn't have the mbstring enabled on my server...whooops

Related

Fatal error because an Error instance is being passed instead of an expected Exception instance

I just installed xampp with php 7.0.4 and a fresh cakephp 3.2.6.
I did a lot of research and everything I found shows that they are compatible.
However as soon as I go to open the application with a browser, cake replies with an Internal Error.
The only pointer as to what to do is that xampp logs the following in apache error.log:
PHP Fatal error: Uncaught TypeError: Argument 1 passed to Cake\Error\BaseErrorHandler::handleException() must be an instance of Exception, instance of Error given in D:\Xampp\htdocs\cakephp\vendor\cakephp\cakephp\src\Error\BaseErrorHandler.php:153
Stack trace:
#0 [internal function]: Cake\Error\BaseErrorHandler->handleException(Object(Error))
#1 {main} thrown in D:\Xampp\htdocs\cakephp\vendor\cakephp\cakephp\src\Error\BaseErrorHandler.php on line 153
I tried php 5.6 but it still shows the error in the log.
If that's the error that you are encountering, then I'd doubt that you are using CakePHP 3.2.6, as line 153 is in the middle of a comment
https://github.com/cakephp/cakephp/blob/3.2.6/src/Error/BaseErrorHandler.php#L153
PHP7 errors are handled since CakePHP 3.1.5, so check your CakePHP dependency, and make sure it's actually up to date.

Fatal Error when implementing an OAuth library to connect to an ETSY store

I am using an OAuth library to connect to my Etsy store (etsy.com) and try to retrieve some information regarding sold orders.
This is the library: https://github.com/Lusitanian/PHPoAuthLib/blob/master/examples/etsy.php
However, I keep getting an error after I "Allow Access". I receive a token but when I allow access the issue is happening.
Here is the full error:
Fatal error: Uncaught exception 'OAuth\Common\Http\Exception\TokenResponseException' with message 'file_get_contents(http://openapi.etsy.com/v2/private/users/__SELF__): failed to open stream: HTTP request failed!
HTTP/1.1 400 Bad Request ' in /hermes/bosoraweb013/b1151/ipg.tahara/APIs/PHPoAuthLib-master/src/OAuth/Common/Http/Client/StreamClient.php:70 Stack trace: #0 /hermes/bosoraweb013/b1151/ipg.tahara/APIs/PHPoAuthLib-master/src/OAuth/OAuth1/Service/AbstractService.php(137):
OAuth\Common\Http\Client\StreamClient->retrieveResponse(Object(OAuth\Common\Http\Uri\Uri), NULL, Array, 'GET') #1 /hermes/bosoraweb013/b1151/ipg.tahara/APIs/PHPoAuthLib-master/examples/etsy.php(47):
OAuth\OAuth1\Service\AbstractService->request('/private/users/...') #2 {main} thrown in /hermes/bosoraweb013/b1151/ipg.tahara/APIs/PHPoAuthLib-master/src/OAuth/Common/Http/Client/StreamClient.php on line 70
Would anyone have any input to identify what the issue is?
The error is telling you that the library was getting back a 400 error which means that the server does not like your request. If this is something that might happen more often than not then a try catch block is your friend if only to terminate gracefully and perhaps log the problem.
If this was me I would have the error, the request and the Library object print_r inside a tag or into a text document so I could get a better idea of what was going on.
I'd be wondering if this was an authentication issue, a need to use HTTPS rather than HTTP, a bug in the library, an end-point issue or just some bad data at some place or other. The more information you have and the more you can isolate and confirm as working the faster I could home in on the problem.
I wish you the best of luck debugging and tracing the fault. I know how insanely frustrating these things can be.

PhpThumb error - PHP Fatal error: Class 'PhpThumb' not found

I had downloaded from official website, uploaded to my hosting server. I got this error message.
[08-Mar-2012 21:26:07] PHP Fatal error: Class 'PhpThumb' not found in /home/sokad
/public_html/libs/phpthumb/thumb_plugins/gd_reflection.inc.php on line 179
Fatal error: Uncaught exception 'RuntimeException' with message 'Cannot show image, headers
have already been sent' in /home/sokad/public_html/libs/phpthumb/GdThumb.inc.php:569 Stack
trace: #0 /home/sokad/public_html/resize.php(14): GdThumb->show() #1 {main} thrown in
/home/sokad/public_html/libs/phpthumb/GdThumb.inc.php on line 569
require_once 'libs/phpthumb/ThumbLib.inc.php';
$thumb = PhpThumbFactory::create($url);
$thumb->adaptiveResize($width, $height);
$thumb->show();
I found that a lot of website also got same problem. Any idea how to solve it?
scan your "phpthumb" directory for all "error_log" files or "_notes" directories, and delete them. In my case I had an error_log file at the thumb_plugins, as soon as I deleted it, it worked on the remote side.
I came to this conclusion because there was no reason why it whould work differently locally and remotely, the only difference? these files.
Good Luck

Dropbox API and PHP

I am gelling following error while trying to read file content which is residing in a subfolder rather than a parent folder.
Fatal error: Uncaught exception 'Exception' with message 'Invalid
signature. Expected signature base string:
GET&https%3A%2F%2Fapi-content.dropbox.com%2F1%2Ffiles%2Fdropbox%2FProjects%2FMAC%2520Error.rtf&oauth_consumer_key%3Dbdagb07uu6zq827%26oauth_nonce%3D46d063d5815a0972d63cf72359c0349f%26oauth_signature_method%3DHMAC-SHA1%26oauth_timestamp%3D1324449973%26oauth_token%3D7f2cr9kppqo2hxz%26oauth_version%3D1.0
(Status Code: 403)' in
/Applications/MAMP/htdocs/dbcatalog/BenTheDesigner-Dropbox-88e3876/Dropbox/OAuth/Consumer/Curl.php:133
Stack trace: #0
/Applications/MAMP/htdocs/dbcatalog/BenTheDesigner-Dropbox-88e3876/Dropbox/API.php(109):
Dropbox\OAuth\Consumer\Curl->fetch('GET', 'https://api-con...',
'files/dropbox/P...', Array) #1
/Applications/MAMP/htdocs/dbcatalog/BenTheDesigner-Dropbox-88e3876/check.php(21):
Dropbox\API->getFile('Projects/MAC Er...') #2 {main} thrown in
/Applications/MAMP/htdocs/dbcatalog/BenTheDesigner-Dropbox-88e3876/Dropbox/OAuth/Consumer/Curl.php
on line 133
I am using Ben's Dropbox Library for php
https://github.com/BenTheDesigner/Dropbox
Thanks
If you are looking for a simple PHP-API you can find one here:
https://github.com/hawaiianchimp/Dropbox-PHP-API/
This is the message thats returned when a OAuth request is signed incorrectly. This is likely the fault of the library you're using. At first glance, it looks like it may be encoding the name of your "MAC Error.rtf" file incorrectly. Checkout the PHP SDK dropbox mentions on its website as an alternative and raise this issue with the library's owner.
The code that generates this would help too.

Error message trying to catch a soapfault using the PHP Soap class

For some reason I can't catch the error. I'm following an example in O'Reillys PHP cookbook, so I'm not doing any cowboy coding (yet).
The error is:
SoapFault exception: [SOAP-ENV:Server] SoapFault::SoapFault() [soapfault.soapfault]: Invalid parameters. Invalid fault code. in C:\xampp\htdocs\soap\client_database.php:13 Stack trace: #0 C:\xampp\htdocs\soap\client_database.php(13): SoapClient->__soapCall('select_query', Array) #1 {main}
I found the solution, you can only use certain error codes when throwing an error.
http://www.w3.org/TR/soap12-part1/#faultcodes
As per the standards there are only 5 possible options for a fault code:
VersionMismatch
MustUnderstand
DataEncodingUnknown
Sender
Receiver
Choose the most appropriate to your situation and use that one as a value for $faultCode when throwing a SoapFault exception.
I got other (weird) SOAP errors in php 5.2.0 which where resolved in php 5.2.8
If you're not on the latest version of php I suggest upgrading and see what happens

Categories