I'm trying to control bitcoin daemon with PHP but I am having an issue when trying to connect to it.
I've followed these steps: en.bitcoin (dot) it/wiki/PHP_developer_intro
PHP code:
<?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>";
?>
Bitcoind conf:
rpcuser=user
rpcpassword=password
server=1
daemon=1
listen=1
var/log/httpd/error_log:
[Tue Apr 06 15:47:15.403045 2015] [:error] [pid 2293] [client 10.0.0.34:50333] PHP Warning: fopen(http://...#127.0.0.1:8332/): failed to open stream: Permission denied in /var/www/html/jsonRPCClient.php on line 132 [Tue Apr 06 15:47:15.410993 2015] [:error] [pid 2293] [client 10.0.0.34:50333] PHP Fatal error: Uncaught exception 'Exception' with message 'Unable to connect to http://user:password#127.0.0.1:8332/' in /var/www/html/jsonRPCClient.php:140\nStack trace:\n#0 /var/www/html/bitcoin_get_info.php(15): jsonRPCClient->__call('getinfo', Array)\n#1 /var/www/html/bitcoin_get_info.php(15): jsonRPCClient->getinfo()\n#2 {main}\n thrown in /var/www/html/jsonRPCClient.php on line 1406
Edit:
$ bitcoin-cli getinfo
Works fine, with PHP it doesn't
Maybe try adding rpcallowip=127.0.0.1 into your config and see what happens.
Also make sure that your bitcoind.conf is actually being used, to test this you can set the daemon to testnet using testnet=1 in bitcoind.conf. Restart your bitcoind server then do bitcoin-cli getinfo to see which network it's connected to. If the change isn't reflected then perhaps the bitcoind.conf file is in another location?
Also, make sure you restart your bitcoind server every time you make a change to the bitcoind.conf file.
Related
I am first time deploying my laravel project in a shared hosting.
I got error:
This page isn’t working. jsquarehospital.com is currently unable to handle this request.
HTTP ERROR 500
I deployed following this tutorial https://www.youtube.com/watch?v=6g8G3YQtQt4
Deploy Method: uploaded project zip in root directory, then uploaded the public folder in public_html and changes index.php
Please help me. My error log
[Sun Oct 18 14:00:33.054366 2020] [php7:warn] [pid 24621] [client 103.25.250.225:28241] PHP Warning: require(/home/jsquare/domains/jsquarehospital.com/public_html/../jshpanel/vendor/autoload.php): failed to open stream: No such file or directory in /home/jsquare/domains/jsquarehospital.com/public_html/index.php on line 24
[Sun Oct 18 14:00:33.054390 2020] [php7:error] [pid 24621] [client 103.25.250.225:28241] PHP Fatal error: require(): Failed opening required '/home/jsquare/domains/jsquarehospital.com/public_html/../jshpanel/vendor/autoload.php' (include_path='.:/usr/local/php73/lib/php') in /home/jsquare/domains/jsquarehospital.com/public_html/index.php on line 24
I am fairly new to Drupal.
I just got an already existing Drupal project and want to install it.
I copied it to: /var/www/html/myprojects/mydrupalproject
Then I got this error in my error.log from apache2:
[Thu May 03 17:55:41.603774 2018] [php7:notice] [pid 11604] [client
127.0.0.1:41930] PHP Notice: Constant DATE_RFC7231 already defined in /var/www/html/myprojects/mydrupalproject/includes/bootstrap.inc on
line 258, referer: http://127.0.0.1/myprojects/
[Thu May 03 17:55:41.604601 2018] [php7:error] [pid 11604] [client
127.0.0.1:41930] PHP Fatal error: require_once(): Failed opening required
'/var/www/html/myprojects/mydrupalproject/profiles/clusters_public/modules/contrib/apc/drupal_apc_cache.inc'
(include_path='.:/usr/share/php') in
/var/www/html/myprojects/mydrupalproject/includes/bootstrap.inc on
line 2632, referer: http://127.0.0.1/myprojects/
So I tried to use the original .htaccess info in case it was the problem but I still get exactly the same error in the log. Any help?
Failed opening required
'/var/www/html/myprojects/mydrupalproject/profiles/clusters_public/modules/contrib/apc/drupal_apc_cache.inc'
Does this file exist on your webserver and is it accessable? Are the correct file-rights set?
I inherited a CakePHP project and I am having issues getting the project running. I am running into these errors
[Fri Feb 02 00:05:35.920569 2018] [:error] [pid 536] [client 172.18.0.1:38124] PHP Warning: include(/home/tablereserv/web/tablereserv.com/public_html/lib/Cake/Error/ErrorHandler.php): failed to open stream: No such file or directory in /src/lib/Cake/Core/App.php on line 547
[Fri Feb 02 00:05:35.920638 2018] [:error] [pid 536] [client 172.18.0.1:38124] PHP Warning: include(): Failed opening '/home/tablereserv/web/tablereserv.com/public_html/lib/Cake/Error/ErrorHandler.php' for inclusion (include_path='.:/usr/share/php') in /src/lib/Cake/Core/App.php on line 547
[Fri Feb 02 00:05:35.920658 2018] [:error] [pid 536] [client 172.18.0.1:38124] PHP Warning: set_error_handler() expects the argument (ErrorHandler::handleError) to be a valid callback in /src/lib/Cake/Core/Configure.php on line 443
The file path that is trying to be included, /home/tablereserv/web/tablereserv.com/public_html/lib/Cake/Error/ErrorHandler.php does exist and the actual path to that file is /src/lib/Cake/Error/ErrorHandler.php
I have found some similar questions like the ones below, but none of the answers were particularly helpful
CakePHP ErrorHandler error
PHP Warning: include(/var/www/html/....../lib/Cake/Error/ErrorHandler.php): failed to open stream Error
When I print out the CAKE_CORE_INCLUDE_PATH variable, I get the correct path but something is obviously going wrong somewhere and I can’t seem to find it.
I also think I should mention that I set up a docker container to run the project in, I’m not sure if that could have an impact on it.
Any help would be greatly appreciated.
In my case, I found out that file mappings are stored in a file with a name similar to appname_cake_core_file_map. Once I deleted the cache file and ran the request again, a new mapping was generated with the correct path.
My website crashes at random times because of a problem with MySQL and I can't quite pinpoint it. For one, the crash itself happens very seldom (perhaps once a month) so I can't replicate it. Because of that, I don't know what exactly is causing the issue.
When I first built our site many years ago, I was using mysql_ calls to connect to the database. I learned the error of my ways and started using PDO. Unfortunately, there is a LOT of code that used the mysql_ calls and I haven't gotten around to replacing every single one of them yet. So, my site has a mix between PDO and mysql_ calls.
When the site connects to the database, it first calls mysql_connect() and then connects to PDO through a wrapper.
The error I'm receiving comes into play when I use mysql_connect(). I've dug through logs and I can't find a specific cause for the error. As soon as it happens, it crashes the MySQL server and therefore the website. I can't even assume that mysql_ is the problem because it crashes before it even gets to the PDO wrapper. It might just be a MySQL connection issue.
I've done some searching and it looks like some others have recommended revising bind-address in my.cnf, which I've done.
I've also gone through the website and tried to remove as many mysql_ calls as possible.
Here's some example logfile output, with some info redacted:
Error connecting to database. Reason: Lost connection to MySQL server at 'reading initial communication packet', system error: 111
[Mon Jun 09 13:01:29 2014] [error] [client ****] PHP Warning: Creating default object from empty value in database.php on line 89
[Mon Jun 09 13:01:29 2014] [error] [client ****] PHP Fatal error: Call to a member function setErrorCallbackFunction() on a non-object in database.php on line $
[Mon Jun 09 13:01:29 2014] [error] [client ****] PHP Warning: Creating default object from empty value in database.php on line 89
[Mon Jun 09 13:01:29 2014] [error] [client ****] PHP Fatal error: Call to a member function setErrorCallbackFunction() on a non-object in database.php on lin$
[Mon Jun 09 13:01:29 2014] [error] [client ****] PHP Warning: mysql_connect(): Lost connection to MySQL server at 'reading authorization packet', system error: 0 in $
[Mon Jun 09 13:01:29 2014] [error] [client ****] PHP Warning: Creating default object from empty value in database.php on line 89
[Mon Jun 09 13:01:29 2014] [error] [client ****] PHP Fatal error: Call to a member function setErrorCallbackFunction() on a non-object in database.php on line $
[Mon Jun 09 13:01:29 2014] [error] [client ****] PHP Warning: Creating default object from empty value in database.php on line 89
[Mon Jun 09 13:01:29 2014] [error] [client ****] PHP Fatal error: Call to a member function setErrorCallbackFunction() on a non-object in database.php on lin$
[Mon Jun 09 13:01:29 2014] [error] [client ****] PHP Warning: mysql_connect(): Lost connection to MySQL server at 'reading authorization packet', system error: 0 in $
Any help would be greatly appreciated.
If the MySQL server crashes, then this issue is caused by the MySQL daemon itself and not your client code.
It can't be the database (schema) either, as you don't get to this point. (the DB is selected after succesful connection )
Make sure that:
MySQL binaries are the latest version or at least the latest version that ships via your distribution package management (same for all libs used by MySQL)
the RAM in your server is sound, maybe run a memcheck
the harddisk in your server is sound, maybe run smart utils or a full disk scan
I'm trying to enable basic debug output with WordPress for a plugin I'm developing. I managed to get some so far, but failed to redirect it to wp-content/debug.log. I've been roughly following the guide by Douglas Neiner. Here's what I did:
I added this snippet of code to the end of wp-config.php:
#ini_set ('display_errors', 0);
define ('WP_DEBUG', true);
define ('WP_DEBUG_DISPLAY', false);
define ('WP_DEBUG_LOG', true);
I manually created debug.log file and made sure it's accessible by www-data user (I'm running WordPress locally, on Ubuntu 12.04):
septi#norbert:~$ sudo su www-data -c 'ls -l /usr/share/wordpress/wp-content/debug.log'
-rw-rw-r-- 1 root www-data 0 Dec 9 22:12 /usr/share/wordpress/wp-content/debug.log
septi#norbert:~$ sudo su www-data -c 'ls -l /srv/www/localhost/wp-content/debug.log'
-rw-rw-r-- 1 root www-data 0 Dec 9 22:12 /srv/www/localhost/wp-content/debug.log
septi#norbert:~$ sudo su www-data -c 'echo i can write >> /usr/share/wordpress/wp-content/debug.log'
septi#norbert:~$
Added a few supposed debug output statement inside the plugin activation hook, as well as the intentional error:
include ('i fail wp');
register_activation_hook (__FILE__, 'hello_world_activate');
function hello_world_activate()
{
error_log ('I love debug output when it works!');
}
What I expect is an error message about the missing include file in debug.log along with the "I love debug output when it works!" message, and nothing on the page. What I get is the missing include file on the page message and nothing in debug.log. The debug output message is not fully lost, however. I found it in the /var/log/apache2/error.log:
[Sun Dec 09 22:58:18 2012] [error] [client 127.0.0.1] PHP Warning: include(i fail wp): failed to open stream: No such file or directory in /usr/share/wordpress/wp-content/plugins/helloworld2085/helloworld2085.php on line 28, referer: http://localhost/wp/wp-admin/plugins.php?deactivate=true&plugin_status=all&paged=1&s=
[Sun Dec 09 22:58:18 2012] [error] [client 127.0.0.1] PHP Warning: include(): Failed opening 'i fail wp' for inclusion (include_path='.:/usr/share/php:/usr/share/pear') in /usr/share/wordpress/wp-content/plugins/helloworld2085/helloworld2085.php on line 28, referer: http://localhost/wp/wp-admin/plugins.php?deactivate=true&plugin_status=all&paged=1&s=
[Sun Dec 09 22:58:18 2012] [error] [client 127.0.0.1] I love debug output when it works!, referer: http://localhost/wp/wp-admin/plugins.php?deactivate=true&plugin_status=all&paged=1&s=
[Sun Dec 09 22:58:18 2012] [error] [client 127.0.0.1] PHP Warning: include(i fail wp): failed to open stream: No such file or directory in /usr/share/wordpress/wp-content/plugins/helloworld2085/helloworld2085.php on line 28, referer: http://localhost/wp/wp-admin/plugins.php?deactivate=true&plugin_status=all&paged=1&s=
[Sun Dec 09 22:58:18 2012] [error] [client 127.0.0.1] PHP Warning: include(): Failed opening 'i fail wp' for inclusion (include_path='.:/usr/share/php:/usr/share/pear') in /usr/share/wordpress/wp-content/plugins/helloworld2085/helloworld2085.php on line 28, referer: http://localhost/wp/wp-admin/plugins.php?deactivate=true&plugin_status=all&paged=1&s=
I suspect that the error_log() function is not the right one to use to output to debug.log, but I failed to find the right way. Oh, of course I could just hardcode the file path and append to it, but, you know...
I encountered the same problem with WordPress running in Apache 2.4 on Fedora 19. Output of error_log() was landing in /var/log/httpd/error_log instead of wp-content/debug.log. Httpd process had write permission (+775) to /var/www/html/wp-content directory, but it was unable to create the wp-content/debug.log file.
My wp-config.php debug setting was:
#ini_set(‘display_errors’,0);
define('WP_DEBUG', true);
define('WP_DEBUG_DISPLAY', false);
define('WP_DEBUG_LOG', true);
As it turned out, the real cause was SELinux. I made SELinux policy change and allowed httpd to write to wp-content with following commands. (Refer SELinux Troubleshooter to get the actual command for your installation)
semanage fcontext -a -t httpd_sys_rw_content_t '/var/www/html/wp-content'
restorecon -v '/var/www/html/wp-content'
After this debug messages start appearing in wp-content/debug.log.
the error_log() function writes to the web server's error log (e.g. /var/log/httpd/error_log); what you want is trigger_error().