php,redis,phpredisRelated issues-Collection of common programming errors


  • zuc0001
    php ajax
    I am calling for a function inside of a class on my website. It works on the majority of pages from what I’ve noticed, however when it tries to do the same thing on AJAX pages (pages that are only accessed through AJAX requests), it seems to error.function formatUsername($id,$link = true,$styles = true, $class = ”){global $users;return $users->formatUsername($id,$link,$styles,$class); }is where it is erroring (the return $users->) bit. (global.php)The actual formatUsername code is: (class.us

  • Serge Roussak
    php memory-leaks large-files
    I get the subj. when I try to make backup of my database in a text file.function backup_tables($backup_filename, $tables = ‘*’) {$conf = new JConfig();$dbhost = $conf->host;$dbuser = $conf->user;$dbpassword = $conf->password;$dbname = $conf->db;$link = mysql_connect($dbhost, $dbuser, $dbpassword);mysql_select_db($dbname, $link) or die(mysql_error());$return = “drop database if exists `$dbname`;\n\ncreate database `$dbname`;\n\nuse `$dbname`;\n\n”;$return .= “/*!40101 SET @OLD_CHARACT

  • Your Common Sense
    php mysql
    <?phpini_set(‘max_execution_time’, 300); //300 seconds = 5 minutes$par1=’0′;$db -> autocommit(FALSE); // start transaction$stmtInv = $db->prepare(“SELECT invoice,date,route,customer FROM test WHERE type = ? GROUP BY invoice”);$par1=”Sales Receipt”;$stmtInv -> bind_param(‘s’,$par1);$stmtInv -> execute();$stmtInv -> bind_result($invoice,$date,$route,$customer);// loop 9,000 recordswhile($stmtInv -> fetch()){ //update statements}$stmtInv -> free_result();$stmt = $db->prep

  • TomFirth
    php mysqli fatal-error
    I’ve searched a lot of basically the same questions on SO which haven’t seemed to help. Been a while since i’ve touched php so i’m guessing there’s a simple solution but really can’t figure it out.config.php: (included into admin.php)$mysqli = new mysqli($mHost, $mUser, $mPass, $db);admin.php:$sqlQuery = “INSERT INTO `category` (`id`, `name`) VALUES (”, ‘$_POST[name]’)”; $result = $mysqli->query($sqlQuery);var_dump($result) returns: NULLand gives error: Fatal error: Call to a member function qu

  • Anagh
    php rss simplepie
    I started using simplepie for RSS and I encountered this error in the very first stage itself.Fatal error: Class ‘SimplePie_Misc’ not found in C:\Program Files\EasyPHP-12.1\www\simplepie\library\SimplePie.php on line 59EDIT The main folder is called ‘simplepie’ The sub folders and files arebuild cache compatibilty_test css idn includes library(has SimplePie.php and a folder called SimplePie) tests index.phpTHIS IS THE CODE<?php //Load simplepie library require_once ‘includes/autoloader.php

  • Robert K
    php windows curl
    I need to make work CURL IN WAMPRunning cmd.exe, I am able to use curlcurl -L http://www.google.comBut when using my website locally (using WAMP, PHP Version 5.3.13) even with enabling extension for curl.I get an error:Fatal error: Call to undefined function curl_init()My PC is a Windows 7 64 bit..Any ideas on how to solve it?

  • hakre
    php simplexml
    I am experiencing a very odd error. I am writing a function to validate XML based on element names, in this case passed in as an array. First, I normalize the input to a SimpleXMLElement object; in this case I am passing in a DOMDocument, and I tested it, it is converting correctly to SimpleXMLElement.What confuses me is that calling getName() will throw the following:PHP Fatal error: Call to a member function getName() on a non-objectBut using exit($xml->getName()) (or echo) will return the

  • Yi Jiang
    php html
    Fatal error: Allowed memory size of 67108864 bytes exhausted (tried to allocate 13965430 bytes)PHPInfo shows that I have a memory_limit of 128M, so I’m confused as to why the error says I only have 64M… Is it possible for phpinfo to report incorrectly? Or for PHP to use two separate php.inis?[UPDATE] The error was being caused by an ini_set call in one of the primary php files that a co-worker of mine added without my knowledge. Thanks for your help guys.

  • IMUXIxD
    php search-engine web-crawler
    There are two pieces to this code: One that adds documents to an index to be searched, which works fine, and a crawl() function that is a web-crawler that gets the contents of a page, which also works fine.But, I need to add a document from inside the crawl() function.When I move the code that adds a document inside the crawl() function, I get a Fatal Error: Fatal Error: call to member function addDocument() on a non-object.I am wondering how I can access the member function addDocument() from i

  • xdazz
    php pdo prepared-statement
    I was getting this Fatal error at the bottom of the page and didn’t see it right away. The error was pointing to a variable, the $sql, an SQL string, which is supposed to be an SQL string. The code was “$s = $pdo->prepare($sql);”. It seemed to work right, accessing the database and retrieving the correct information. I had used this code before earlier on another page creating a new PDO connection. Finally, after reading one of the comments on this error which I can’t find again, I decid

  • Siva
    redis
    I am trying to start the redis-server that was installed in windows PC as deamonize service. I configured the redis.conf file to accept the pidfile and logfile path as follows:pidfile D:\HMS Build\redis\bin\redis.pid …. logfile D:\HMS Build\logs\redis.logWhile i was trying to start the server, i am getting the following error message.*** FATAL CONFIG FILE ERROR *** Reading the configuration file, at line 52 >>> ‘logfile D:\HMS Build\logs\redis.log’ Can’t open the log file: Invalid arg

  • poseid
    chef redis chef-solo
    I am trying to install Redis with Chef. I would think, it’s easy, since I only want to have the default configuration.So, I add to a Berksfile:site :opscodecookbook ‘apt’ cookbook ‘node’ cookbook ‘rvm’, :git => “https://github.com/fnichol/chef-rvm” cookbook ‘runit’ cookbook ‘redis’Then, I run: vagrant provisionBut I get this:2013-12-11T21:18:23+00:00] DEBUG: chef_gem[rvm] is already installed – nothing to do [2013-12-11T21:18:23+00:00] DEBUG: Loading Recipe rvm::vagrant via include_recipe [2013-

  • Narek
    redis phpredis
    UPDATE – SOLUTION FOR MENeed to install redis-server, in Ubuntu by command: sudo apt-get install redis-serverI installed phpredis, an can see in phpinfo():Redis Version 2.2.3After calling class constructor:$redis = new Redis(); $redis->connect(‘127.0.0.1’, 6379, 2.5);everything is ok.print_r($redis);returns Redis Object ( [socket] => Resource id #21 ). But when I want to call any other method, for example:$redis->info();I got error:Fatal error: Uncaught exception ‘RedisException’ with

  • David Villa
    ruby-on-rails ruby redis hiredis
    I am trying to install recommendify gem.This gem try to compile a native bin called recommendify to be faster than ruby´s parser.First i tried to install like other common gem:gem install recommendifyand this is the error:? ~ gem install recommendify Building native extensions. This could take a while… ERROR: Error installing recommendify: ERROR: Failed to build gem native extension./Users/villa/.rbenv/versions/1.9.3-p448/bin/ruby extconf.rbmake mkdir -p ../bin gcc -Wall recommendify.c -lh

  • ilupper
    sql redis relational in-memory
    I have a simpleton question on Redis. If the key to it’s performance is that it’s in-memory, whey can’t that be done on a regular SQL db?

  • remudada
    python websocket redis uwsgi asyncsocket
    Hi I have a simple websocket server which is pushing messages to clients, the code is as followsuwsgi.websocket_handshake(env[‘HTTP_SEC_WEBSOCKET_KEY’], env.get(‘HTTP_ORIGIN’, ”))print(“websockets…”)r = redis.StrictRedis(host=’localhost’, port=6379, db=0)channel = r.pubsub()channel.subscribe(‘backchannel’)websocket_fd = uwsgi.connection_fd()redis_fd = channel.connection._sock.fileno()while True:uwsgi.wait_fd_read(websocket_fd, 3)uwsgi.wait_fd_read(redis_fd)uwsgi.suspend()fd = uwsgi.ready_fd()

  • Shafik Yaghmour
    c redis undefined-behavior
    I had a problem in reading redis source code, can anyone tell me what is the use of the last statement in the _redisAssert function in debug.c:*((char*)-1) = ‘x’;`,

  • igorpavlov
    node.js redis node-redis
    I am using NodeJS + Express + Redis on RedisOnGo + node_redis as a client. I expect a lot of concurrency, so trying to test WATCH. This example won’t contain Express, just necessary stuff.var redis = require(“redis”) var rc = redis.createClient(config.redis.port, config.redis.host)rc.auth(config.redis.hash, function(err) {if (err) {throw err} })rc.on(‘ready’, function () {rc.set(“inc”,0)for(var i=1;i<=10;i++){rc.watch(“inc”)rc.get(“inc”,function(err,data){var multi = rc.multi()data++ // I do

  • Didier Spezia
    redis
    Consider following example:#include <stdlib.h> #include <stdio.h> #include <errno.h> #include <hiredis/hiredis.h>int main(int argc, char **argv) {redisContext *redis;redisReply *reply;redis = redisConnect(“127.0.0.1”, 6379);if(redis->err) {fprintf(stderr, “Connection error: %s\n”, redis->errstr);exit(EXIT_FAILURE);}reply = redisCommand(redis, “SET %s %s”, “foo”, “bar”);printf(“SET %s %s: %s\n”, “foo”, “bar”, reply->str);freeReplyObject(reply);reply = redisCommand

  • Scott
    c# redis servicestack
    We’re using ServiceStack RedisClient for caching. Lately we had some network latency between Redis and our web server. We use PooledRedisClientManager. We noticed the following behavior when we send a command (specifically Get):There’s some latency in the network We get a SocketIO exception: Unable to read data from the transport connection: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected

  • Narek
    redis phpredis
    UPDATE – SOLUTION FOR MENeed to install redis-server, in Ubuntu by command: sudo apt-get install redis-serverI installed phpredis, an can see in phpinfo():Redis Version 2.2.3After calling class constructor:$redis = new Redis(); $redis->connect(‘127.0.0.1’, 6379, 2.5);everything is ok.print_r($redis);returns Redis Object ( [socket] => Resource id #21 ). But when I want to call any other method, for example:$redis->info();I got error:Fatal error: Uncaught exception ‘RedisException’ with

  • Stephen Sarcsam Kamenar
    php redis phpredis
    “PHP Fatal error: Uncaught exception ‘RedisException’ with message ‘read error on connection'”The driver here is phpredis$redis->blpop(‘a’, 0);This always times out after ~1 minute. My redis.conf says timeout 0 and $redis->getOption(Redis::OPT_READ_TIMEOUT) returns double(0)If I do this it has never timed out $redis->setOption(Redis::OPT_READ_TIMEOUT, -1);Why do I need -1? Redis documentation says timeout 0 in redis.conf should never time me out.”By default recent versions of Redis don

Web site is in building