0

I can't connect to bitcoin, tried everything, googled extensively and tried but can't resolve.

I have a bitcoin.conf file created but I am not sure it is being accessed during the run of "hello.php"

I a using XAMPP and the Apache server working.

The contents of the bitcoin.conf file is

server=1
rpcuser=12345
rpcpassword=12345
rpcallowip=*
listen=1

The location is \%appdata%\bitcoin

I will say that 99% of my problems are with paths not working mostly but appear to have it working on that level.

I am running the .php file from c:\xampp\htdocs\xampp\hello.php because that is the only place I can get XAMPP to run a .php file from. I am ok with that for now. I had to copy a lot of files in that sub dir to get it working, like i.e jsonRPCClient.php and all assocoiated files.

Still no idea why "the target machine actively refused it" sounds like it is being asked to connect, but wont connect.....no clue why.

I am running Windows 7 on a laptop..

my file hello.php code is

 <?php 
 Print "Hello, World!";
 ?> 

 <?php 
 Echo "Hello , World!";

#echo phpinfo();

require_once 'jsonRPCClient.php';

  $bitcoin = new jsonRPCClient('http://user:password@127.0.0.1:8332/');
  echo "<pre>\n";
  print_r($bitcoin->getinfo()); echo "\n";
  echo "Received: ".$bitcoin->getreceivedbylabel("Your Address")."\n";
  echo "</pre>";

# $connect = new jsonRPCClient('http://user:password@127.0.0.1:9332');
# print_r($connect->getinfo()); echo "\n";


#$b = new jsonRPCClient('http://KJTetc:MyRpcpass@localhost:8332/');
#print_r($b->getinfo());



 ?> 

The output is :

Hello, World! Hello , World!

Warning:  fopen(http://...@127.0.0.1:8332/): failed to open stream: No connection could be made because the target machine actively refused it.
 in C:\xampp\php\pear\jsonRPCClient.php on line 132

Fatal error:  Uncaught exception 'Exception' with message 'Unable to connect to http://user:password@127.0.0.1:8332/' in C:\xampp\php\pear\jsonRPCClient.php:140
Stack trace:
#0 C:\xampp\htdocs\xampp\hello.php(14): jsonRPCClient->__call('getinfo', Array)
#1 C:\xampp\htdocs\xampp\hello.php(14): jsonRPCClient->getinfo()
#2 {main}
  thrown in C:\xampp\php\pear\jsonRPCClient.php on line 140
  • rpcallowip uses CIDR notation, not wildcards. For connecting to localhost you don't need to specifically allow it anyway, that's enabled by default. – Anonymous Jul 17 '15 at 6:26
  • Thanks Bitcoin. But that does not fix the problem right ? – Aussie in Perth Jul 17 '15 at 7:14
  • What version of bitcoin core are you using? And in case you aren't familiar with CIDR notation, the proper replacement for rpcallow=* would be rpacallow=0.0.0.0/0 – morsecoder Jul 29 '15 at 16:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.