memcached not working on codeigniter 2.1.0 - memcached

I have been trying to make it work for sometime now, but I can't. I am working on a Windows 7 64bits, I have the Memcached Server running as Service, I have the php_memcached.dll extension in the PHP 5.3.8 and when I call it on the app in Codeigniter I do it the right way (I Think).
$this->load->driver('cache', array('adapter' => 'memcached', 'backup' => 'file'));
var_dump($this->cache->memcached->is_supported());
die();
but it throws a false so I don't know what I am doing wrong. When I call it like this:
$this->load->driver('cache', array('adapter' => 'memcached', 'backup' => 'file'));
$data = $this->cache->memcached->get('data_' . $idData);
I get this PHP error:
Fatal error: Call to a member function get() on a non-object in E:\workspace\example\system\libraries\Cache\drivers\Cache_memcached.php on line 50
Thanks for the help :-)

The CI driver is looking for the Apache Module, but in WIN we use mostly the PHP-Class Memcache.
Try to change Line 165 in /system/libraries/Cache/drivers/Cache_memcached.php
$this->_memcached = new Memcached();
For me it works after changing from Memcached to Memcache.
$this->_memcached = new Memcache();

I know this is old, but I just came across the same issue.
On Windows, you should be using "Memcache" rather than "Memcached". To do this, follow the instructions on this page:
http://www.leonardaustin.com/technical/how-to-install-memcached-on-xampp-on-windows-7
Then, to get it working in CI, you'll need to make two small changes to \system\libraries\Cache\drivers\Cache_memcached.php:
In function is_supported(), replace:
if ( !extension_loaded('memcached'))
With:
if ( !extension_loaded('memcached') && !extension_loaded('memcache'))
And in function _setup_memcached(), replace:
$this->memcached = new Memcached();
With:
if(class_exists("Memcached"))
$this->_memcached = new Memcached();
else
$this->_memcached = new Memcache();

Related

Perl Invalid version format from Compat.pm

I'm trying to publish a module, and am running into a lot of weird errors, the latest of which is as follows:
C:\Shared\John\Perl\unifdef+.0.5.1>build disttest
Creating Makefile.PL
Invalid version format (non-numeric data) at C:/perl/lib/Module/Build/Compat.pm
line 134.
The code at the specified line is:
if ( my $minimum_perl = $requires->{perl} ) {
my $min_ver = version->new($minimum_perl)->numify;
print {$fh} "require $min_ver;\n";
}
so it looks like $minimum_perl is corrupted. I do have the line:
require 5.10.0;
In the code, but that should be OK according to the documentation I've read.
I tried upgrading various modules, and finally I tried a cpan upgrade, and upgraded my entire cpan, but I'm still getting the error. Can anyone tell me what I'm doing wrong? I am running perl 5.24.1
Ok, figured it out (sort of). I'm posting an answer, as I assume others will run into the same problem, and hopefully this will help them. My Build.PL script was a cut/paste/modify from an example on the web. I had the following:
use 5.010000; # NOT 5.8.8 - needed by CPAN testers
use Module::Build;
my $builder = Module::Build->new( module_name => 'code::unifdef+'
, license => 'perl'
, requires => { perl => '>= 5.10.0' } #hmm, this doesn't work...
, dist_version => '0.005.001'
, dist_author => 'John Ulvr <perldev#ulvr.com>'
, dist_abstract => 'processes conditional parts of makefiles, c/c++ and kconfig files'
, create_readme => 0
, create_makefile_pl => 'traditional'
);
$builder->create_build_script; #generate Build
The requires line was causing the problem. I'm not sure why though, as I've seen other similar examples on the web of the requires clause, so either everyone is wrong, or there's some sort of bug in in Compat.pm. Removing the requires line fixes the problem (I have requires in the .pl file itself, so it should catch out-of-date issues).

Class 'mPDF' not found in Yii2

I have problem with my page on server.
I'm using yii2 framework and mPDF;
All configured according to the instructions: http://www.bsourcecode.com/yiiframework2/create-pdf-files-using-mpdf-in-yiiframework-2-0/
Page work on localhost on Windows and Xampp
When I try run page on Debian 8 I have error:
Class 'mPDF' not found
Configuration: http://www.bsourcecode.com/yiiframework2/create-pdf-files-using-mpdf-in-yiiframework-2-0/
function in php:
public function actionCreatepdf()
{
$request = Yii::$app->request;
$generate_table = $request->post();
$mpdf = new mPDF;
$mpdf->WriteHTML($this->renderPartial('view_pdf', ['data'=>$data]));
$mpdf->Output('data.pdf', 'D');
exit;
}
I have no idea what I'm doing wrong, it's not running on Debian
I had this issue when migrating from Ubuntu (php 5.6) to CentOS 7 (PHP 7.1)
The easiest thing to do, without manually editing the composer file was to change the use/import in the controller:
//use mPDF; #Php 5.6
use Mpdf\Mpdf; #Php 7.0
Solved! As mentioned before it was due to capital cases.
I used following and it is now working on CENTOS 7 (probably similar on most Linux versions)
<?php
namespace app\controllers;
use Yii;
//use mPDF; Note this line is Commented out
use mpdf;
And then use it as follows:
public function actionIndex(){
$model = new Mpdf();
$model->SetHeader('header');
$model->WriteHTML("PDF contents");
$model->SetFooter('footer');
$model->Output('MyPDF.pdf', 'D');
exit;
}
In my case which i just resolved, adding
'mPDF\' => array($vendorDir . '/mpdf') to autoload_psr4.php required me to namespace most of the class files in ../mpdf/classes using the line
namespace mPDF;
Also among the errors i fixed was changing include to include_once to prevent php from seeing some classes as duplicate declaration despite the presence of class_exists() test

Error while installing Moodle 29

I have place moodle files: C:\xampp\htdocs\moodle, E:\moodledata and in mysql created database "moodle".I m getting this error message on the webpage when opening moodle
"Config table does not contain version, can not continue, sorry.
More information about this error
It is usually not possible to recover from errors triggered during installation, you may need to create a new database or use a different database prefix if you want to retry the installation."
Setting in config.php
<?php // Moodle configuration file
unset($CFG);
global $CFG;
$CFG = new stdClass();
$CFG->dbtype = 'mysqli';
$CFG->dblibrary = 'native';
$CFG->dbhost = 'localhost';
$CFG->dbname = 'moodle';
$CFG->dbuser = 'root';
$CFG->dbpass = '';
$CFG->prefix = 'lms_';
$CFG->dboptions = array (
'dbpersist' => 0,
'dbport' => '',
'dbsocket' => '',
);
$CFG->wwwroot = 'http://'.$_SERVER['HTTP_HOST'].'/moodle';
$CFG->dataroot = 'E:\\moodledata';
$CFG->admin = 'admin';
$CFG->directorypermissions = 0777;
require_once(dirname(__FILE__) . '/lib/setup.php');
// There is no php closing tag in this file,
// it is intentional because it prevents trailing whitespace problems!
It looks like it got interrupted during install and now the database is incomplete. You can try two things: insert the missing version number into the config table, for example by using phpMyAdmin, or delete the database, create a new one and try to install again.
To insert the version number:
open the file version.php to find the version number.
in your database manager, go to the table mdl_config
insert a new record with the values: name='version' and value='the version number you looked up in the version.php file'
this can happen if the install process is not perfect.
You haven't told us the version or anything about the 'local server'
so we can not see the specifics of your problem.
check the release notes for the version you are using and make sure 100% that your server meets the requirements.

Calling Openoffice from Perl throws NoSuchElementexception

I try to convert odt-Files to doc-Files using OpenOffice. Installed Version is 3.1.1 and can't be changed at the moment. Perl Version is 5.18.
The Perl-module OpenOffice::UNO is used for this conversion. Unfortunately in newer Versions of OpenOffice/LibreOffice do not support Perl anymore.
The Script calls OpenOffice headless using xvfb.
Here is the code used:
`# Launch OpenOffice.org as a server
$ ooffice \
"-accept=socket,host=localhost,port=8100;urp;StarOffice.ServiceManager"
use OpenOffice::UNO;
# connect to the OpenOffice.org server
$uno = OpenOffice::UNO->new;
$cxt = $uno->createInitialComponentContext('file:///.../path/perluno');
$sm = $cxt->getServiceManager;
$resolver = $sm->createInstanceWithContext
("com.sun.star.bridge.UnoUrlResolver", $cxt);
$rsm = $resolver->resolve
("uno:socket,host=localhost,port=8100;urp;StarOffice.ServiceManager");
# get an instance of the Desktop service
$rc = $rsm->getPropertyValue("DefaultContext");
$desktop = $rsm->createInstanceWithContext("com.sun.star.frame.Desktop", $rc);
.....`
On the last included line to create $desktop i get following Error message:
terminate called after throwing an instance of 'com::sun::star::container::NoSuchElementException'
Is there any way to fix this problem? Tried to understand the Code of the UNO-interface, especially UNO.xs but there has not been any information about the call "createInstanceWithContext".
Looking through the OpenOffice-documentation does not provide any information about this either.
It would also help just to get the complete java error message, to make sure what element is missing.
The file "perluno" has the content:
[Bootstrap]
UNO_TYPES=/usr/lib64/openoffice.org//program/types.rdb
UNO_SERVICES=/usr/lib64/openoffice.org//program/services.rdb

Ocramius / Doctrine & Zend validate-schema Acess denied

I am doing the tutorial from Marco Pivetta for Ocramius and Zend, I am stuck at the step where I should validate the schema. (See here: Link to the tutorial )
So actually I am stuck at the same point like at this question, already asked on stackoverflow.
The author on this question found the solution obviously, but for me it's not working.
He writes
And, if you use gitBash don't forget if you have tested your APPLICATION_ENV variable in application.config.php like this tutorial Zf2 advances config setup do in bash_profile file.
export APPLICATION_ENV="development"
I did this in my application.config.php
$env = getenv('APP_ENV') ?: 'development';
// Use the $env value to determine which modules to load
$modules = array(
'ZendDeveloperTools',
'Application',
'DoctrineModule',
'DoctrineORMModule',
);
if ($env == 'production') {
$modules[] = 'ZendDeveloperTools';
}
return array(
'modules' => $modules,
[...]
But I still get the error
[PDOException]
SQLSTATE[HY000] [1045] Access denied for user 'username'#'localhost' (using password: YES)
I have to say though, I couldn't figure out what the author means with the
[... ] bash_profile file:
export APPLICATION_ENV="development
His sentence is written without regarding any grammatical sense.
So the problem is:
Somehow my doctrine.local.php in the autoloads is ignored, I can't figure out why.
I am using GitBash for the
./vendor/bin/doctrine-module orm:validate-schema
command.
Got it:
Make sure you are using GitBash and ZendStudio in administrator mode -.-