i have a problem when use jsonRPCClient to get info bitcoin on my vps ubuntu, and i dont'n know how can fix it.
<?php
require_once 'jsonRPCClient.php';
$bitcoin = new jsonRPCClient('http://user:password#127.0.0.1:8332/');
echo "<pre>\n";
print_r($bitcoin->getinfo());
echo "</pre>";
?>
my config:
server=1
rpcuser=username
rpcpassword=pass123
rpcallowip=127.0.0.1
daemon=1
it has error:
Warning: fopen(http://...#127.0.0.1:8332/): failed to open stream: Connection refused in /var/www/.../jsonRPCClient.php on line 133
Fatal error: Uncaught exception 'Exception' with message 'Unable to connect to http://user:password#127.0.0.1:8332/' in /var/www/.../jsonRPCClient.php:141
Stack trace:
#0 /var/www/.../common.php(15): jsonRPCClient->__call('getinfo', Array)
#1 /var/www/.../common.php(15): jsonRPCClient->getinfo()
#2 /var/www/.../index.php(3): include('/var/www/coinba...')
#3 {main}
thrown in /var/www/.../jsonRPCClient.php on line 141
how to fix it, help me, please!!!
It would appear your username and password do not match you bitcoin.conf file.
rpcuser=username
rpcpassword=pass123
('http://user:password#127.0.0.1:8332/');
It can be difficult to debug with jsonRPCclient for this exact reason. The jsonRPCClient library uses fopen() and will throw an exception saying "Unable to connect" if it receives a 404 or 500 error from bitcoind. This prevents you from being able to see error messages generated by bitcoind.
Also it is recommended to use easybitcoin library instead of jsonRPCClient.
Source
Instead, follow the above link, use the easybitcoin.php library, and give this a try.
require("easybitcoin.php");
$bitcoin = new Bitcoin("username", "pass123");
$info = $bitcoin->getinfo();
print_r($info);
Related
I have a problem when I try to log to my database with php. I have a website in php and I need to use a database so I have file where I try to connect :
$db = new PDO('mysql:host=IP;dbname=DB_Name', 'Username', '********');
$db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
return $db;
Then I have an error :
Fatal error: Uncaught PDOException: Packets out of order. Expected 0
received 1. Packet size=78 in /var/www/html/index.php:6 Stack trace:
#0 /var/www/html/index.php(6): PDO->__construct() #1 {main} Next PDOException: SQLSTATE[HY000] [2006] MySQL server has gone away in
/var/www/html/index.php:6 Stack trace: #0 /var/www/html/index.php(6):
PDO->__construct() #1 {main} thrown in /var/www/html/index.php on line
6
My database is on a VPS. The database is installed on it with my php code.
I already looked on internet for solution but nothing changed.
Thanks for your help.
if you’re getting the Packets out of order error in the PHP log, there’s an high chance that the issue is due to the fact that there’s an incompatibility between the PHP and MySQL versions you’re using. If upgrading them is not an option, you could try to add the following statement to the PHP script that causes the issue:
$db->setAttribute(PDO::ATTR_EMULATE_PREPARES, true);
Maybe this may help...
screenshot of "SHOW VARIABLES LIKE '%timeout%'"
We used "cPanel API2" library to create park domain in our server and it was working fine until last cPanel up-gradation.
We created file mytest.live.php on server to create a object of "CPANEL class" for troubleshooting the issue, but unfortunately it returns error as below.
<?php
require_once "/usr/local/cpanel/php/cpanel.php";
$cpanel = new CPANEL(); ?>
And Output Returns:
Fatal error: Uncaught exception 'RuntimeException' with message 'There was a problem fetching the env variablecontaining the path to the socket' in /usr/local/cpanel/php/cpanel.php:146 Stack trace: #0 /home/cityusa/public_html/mytest.live.php(4): CPANEL->__construct() #1 {main} thrown in /usr/local/cpanel/php/cpanel.php on line 146
So please help for resolve this issue.
You should try naming your file as ".live.php" or ".livephp". That worked for me.
I am trying to get connected with Magento.
$WSDLUrl1 = "http://mysite/index.php/api/?wsdl";
$proxy = new SoapClient($WSDLUrl1);
$sessionId = $proxy->login('soapusername', 'apikey');
var_dump($sessionId);
i can print the
$proxy
but failed to get
$sessionId
version -Magento 1.8
Created soap user and assign the admin role with all module permissions already
Error says
Fatal error: Uncaught SoapFault exception: [HTTP] Internal Server Error in
C:\wamp\www\ondemand\test.php:41 Stack trace: #0 [internal function]: SoapClient-
>__doRequest('<?xml version="...', 'http://mysite...', 'urn:Mage_Api_Mo...', 1, 0)
#1 C:\wamp\www\ondemand\test.php(41): SoapClient->__call('login', Array)
#2 C:\wamp\www\ondemand\test.php(41): **SoapClient->login('soapusername', 'apikey')**
#3 {main} thrown in C:\wamp\www\ondemand\test.php on line 41
Please help..
Without more error log details I can't say for sure what the issue is, but I had similar results when trying to access an API for a Magento EE 1.12.0.2 site. It worked fine in my local instance, but not on the remote server. In my case I was getting the following in my error log...
FastCGI: comm with server "/var/www/html/php.fpm" aborted: error parsing headers: duplicate header 'Content-Type'
The cause of this was due to the setHeader() in the run() method in the file app/code/core/Mage/Api/Model/Server/Adapter/Xmlrpc.php. The cause of which is explained in more detail here... http://www.magegyver.de/duplicate-content-type-header-on-api-responses/
They also developed a small extension that you can add to correct this... https://github.com/MageGyver/ApiImprovements
I'm testing the OAuth2 service with google-api-php-client library to access UserInfo of logged users with their Google account. The code is taken from examples/userinfo/index.php with little change to cope with my host. When running the example, it passed through Google login form. When it came back to my site, an exception thrown as following.
Fatal error: Uncaught exception 'apiIOException' with message 'HTTP Error: (0) couldn't connect to host' in /home/ztbmwjhd/public_html/apis/at/googleplus/google-api-php-client/src/io/apiCurlIO.php:120
Stack trace:
#0 /home/ztbmwjhd/public_html/apis/at/googleplus/google-api-php-client/src/io/apiCurlIO.php(46): apiCurlIO->makeRequest(Object(apiHttpRequest))
#1 /home/ztbmwjhd/public_html/apis/at/googleplus/google-api-php-client/src/io/apiREST.php(55): apiCurlIO->authenticatedRequest(Object(apiHttpRequest))
#2 /home/ztbmwjhd/public_html/apis/at/googleplus/google-api-php-client/src/service/apiServiceResource.php(151): apiREST::execute(Object(apiServiceRequest))
#3 /home/ztbmwjhd/public_html/apis/at/googleplus/google-api-php-client/src/contrib/apiPlusService.php(207): apiServiceResource->__call('get', Array)
#4 /home/ztbmwjhd/public_html/apis/at/googleplus/google-plus-access.php(40): PeopleServiceResource->get('me')
#5 /home/ztbmwjhd/public_html/apis/at/googleplus/index.php(2): include_once('/home/ztbmwjhd/...')
#6 {main}
throw in /home/ztbmwjhd/public_html/apis/at/googleplus/google-api-php-client/src/io/apiCurlIO.php on line 120
Thank you for your help
The error "HTTP Error: (0) couldn't connect to host" typically means theres a problem between your server and google. Are you connecting through a proxy?
Also, try to run "curl https://www.googleapis.com/discovery/v1/apis" from your command line.
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