Installation and using elasticsearch php client on Windows Xampp - php

I'm downloaded the elasticsearch-5.1.1.zip from the https://www.elastic.co/downloads/elasticsearch
Then download the Elastica A PHP client for elasticsearch via composer with this command
composer require ruflin/elastica:dev-master
Now i want to open and make a test. When i run this command
bin\elasticsearch.bat
i get this error: The syntax of the command is incorrect.
On the other side if i try to use Elastica A PHP client i get some errors like this:
Fatal error: Uncaught Elastica\Exception\Connection\HttpException:
Couldn't connect to host, Elasticsearch down? in
E:\xampp\htdocs\el\vendor\ruflin\elastica\lib\Elastica\Transport\Http.php:180
Stack trace: #0
E:\xampp\htdocs\el\vendor\ruflin\elastica\lib\Elastica\Request.php(171):
Elastica\Transport\Http->exec(Object(Elastica\Request), Array) #1
E:\xampp\htdocs\el\vendor\ruflin\elastica\lib\Elastica\Client.php(662):
Elastica\Request->send() #2
E:\xampp\htdocs\el\vendor\ruflin\elastica\lib\Elastica\Client.php(673):
Elastica\Client->request('twitter/', 'DELETE', Array, Array) #3
E:\xampp\htdocs\el\vendor\ruflin\elastica\lib\Elastica\Index.php(531):
Elastica\Client->request('twitter/', 'DELETE', Array, Array) #4
E:\xampp\htdocs\el\vendor\ruflin\elastica\lib\Elastica\Index.php(165):
Elastica\Index->request('twitter/', 'DELETE') #5
E:\xampp\htdocs\el\vendor\ruflin\elastica\lib\Elastica\Index.php(258):
Elastica\Index->delete() #6 E:\xampp\htdocs\el\index.php(40):
Elastica\Index->create(Array, true) #7 {main} thrown in
E:\xampp\htdocs\el\vendor\ruflin\elastica\lib\Elastica\Transport\Http.php
on line 180
My question is How can i work with elasticsearch-5.1? Where am i do wrong?
Regards.

https://www.elastic.co/guide/en/elasticsearch/reference/master/windows.html#windows
At the note said, you're missing JDK8 or later

Related

Trying to upgrade to laravel 5.3 but I keep seeing error `Call to undefined method Illuminate\Auth\Access\Gate::abilities()`

I am trying to upgrade laravel 5.3 from 5.2 but I keep seeing these two errors in my log file:
Symfony\Component\Debug\Exception\FatalErrorException: Uncaught Error: Call to undefined method Illuminate\Auth\Access\Gate::abilities() in /Users/rohan0793/Code/poptin_v3/vendor/laravel/framework/src/Illuminate/Support/Facades/Facade.php:237
And this one:
Symfony\Component\Debug\Exception\FatalThrowableError: Call to undefined method Illuminate\Log\Writer::setHandlers() in Command line code:1
Full stack outputs:
[2020-08-13 08:26:58] local.ERROR: Symfony\Component\Debug\Exception\FatalErrorException: Uncaught Error: Call to undefined method Illuminate\Auth\Access\Gate::abilities() in /Users/rohan0793/Code/poptin_v3/vendor/laravel/framework/src/Illuminate/Support/Facades/Facade.php:237
Stack trace:
#0 Command line code(1): Illuminate\Support\Facades\Facade::__callStatic('abilities', Array)
#1 {main}
thrown in /Users/rohan0793/Code/poptin_v3/vendor/laravel/framework/src/Illuminate/Support/Facades/Facade.php:237
[2020-08-13 08:26:58] local.ERROR: Symfony\Component\Debug\Exception\FatalThrowableError: Call to undefined method Illuminate\Log\Writer::setHandlers() in Command line code:1
Stack trace:
#0 [internal function]: VscodeLaravelExtraIntellisenseProvider->boot()
#1 /Users/rohan0793/Code/poptin_v3/vendor/laravel/framework/src/Illuminate/Container/Container.php(508): call_user_func_array(Array, Array)
#2 /Users/rohan0793/Code/poptin_v3/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(769): Illuminate\Container\Container->call(Array)
#3 /Users/rohan0793/Code/poptin_v3/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(752): Illuminate\Foundation\Application->bootProvider(Object(VscodeLaravelExtraIntellisenseProvider))
#4 [internal function]: Illuminate\Foundation\Application->Illuminate\Foundation\{closure}(Object(VscodeLaravelExtraIntellisenseProvider), 2)
#5 /Users/rohan0793/Code/poptin_v3/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(753): array_walk(Array, Object(Closure))
#6 /Users/rohan0793/Code/poptin_v3/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/BootProviders.php(17): Illuminate\Foundation\Application->boot()
#7 /Users/rohan0793/Code/poptin_v3/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(203): Illuminate\Foundation\Bootstrap\BootProviders->bootstrap(Object(Illuminate\Foundation\Application))
#8 /Users/rohan0793/Code/poptin_v3/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(267): Illuminate\Foundation\Application->bootstrapWith(Array)
#9 /Users/rohan0793/Code/poptin_v3/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(113): Illuminate\Foundation\Console\Kernel->bootstrap()
#10 Command line code(1): Illuminate\Foundation\Console\Kernel->handle(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
I have no idea where these are coming from and how to resolve them.
UPDATE: I see these errors every minute at 41 secs. Example 13:35:41
But according to my crontab in homestead, I don't have any crons scheduled
UPDATE 2: https://github.com/illuminate/auth/blob/5.5/Access/Gate.php the abilities method is present in 5.5. But I am still at 5.3. Weird but I don't know what is calling that code already. Maybe a third party package.
https://marketplace.visualstudio.com/items?itemName=amiralizadeh9480.laravel-extra-intellisense
This VS Code extension was causing the 2 errors, and it was trying to compile something every minute and hence it was very confusing and felt like a cron job running in the background.
Try to find on official documentation for upgrade guide. They cover a lot of issues and maybe you find yours. It's a very specific issue and you are missing something in your code, but from a question, we can't know. https://laravel.com/docs/5.3/upgrade#upgrade-5.3.0
Also try Rector for upgrade or any issue after upgrade https://github.com/rectorphp/rector

When I opened the project,I get back this error message

When I opened the project,I get back this error message :
Fatal error: Uncaught Error: Class 'String' not found in /dev/local/lib/Cake/Utility/Debugger.php:339 Stack trace: #0 /dev/local/lib/Cake/Utility/Debugger.php(741): Debugger::trace(Array) #1 /dev/local/lib/Cake/Error/ErrorHandler.php(219): Debugger->outputError(Array) #2 /dev/local/lib/Cake/Core/App.php(565): ErrorHandler::handleError(2, 'Declaration of ...', '/dev/local...', 25, Array) #3 /dev/local/lib/Cake/Core/App.php(565): include() #4 [internal function]: App::load('TradeLog') #5 [internal function]: spl_autoload_call('TradeLog') #6 /dev/local/lib/Cake/Utility/ClassRegistry.php(145): class_exists('TradeLog') #7 /dev/local/app/Controller/Component/UserComponent.php(61): ClassRegistry::init('TradeLog') #8 /dev/local/app/Controller/Component/PlatformAgentComponent.php(24): UserComponent->__construct(Object(ComponentCollection), Array) #9 /Us in /dev/local/lib/Cake/Utility/Debugger.php on line 339
The newly configured environment in mac os.
When I paste the project into a folder, this error occurs. What's the matter?
This is a compatibility issue between Cakephp 2.4 and PHP7 (because string became reserved word in PHP7, so Cakephp cannot use it as a class name). Using of newer version of Cakephp is suggested. Also downgrading your PHP to 5.6 could solve the problem.
You need to upgrade to CakePHP > 2.8 which is compatible with PHP7
https://github.com/cakephp/cakephp/releases/2.8.0

Yii2 console app - cookieValidationKey config errors

I have configured the cookieValidationKey inside my backend\config\main.php and frontend\config\main.php and removed it from common\config\main.php. But when I run php yii inside command line. I get this error.
Even before I set it inside to my backend config the error showed up when I used the command line.
$ php yii
Exception 'yii\base\UnknownPropertyException' with message 'Setting unknown property: yii\console\Request:
:cookieValidationKey'
in D:\web\wamp64\www\html\royall.dev\vendor\yiisoft\yii2\base\Component.php:201
Stack trace:
#0 D:\web\wamp64\www\html\royall.dev\vendor\yiisoft\yii2\BaseYii.php(525): yii\base\Component->__set('cook
ieValidatio...', '9H2hvsco52yQ0N2...')
#1 D:\web\wamp64\www\html\royall.dev\vendor\yiisoft\yii2\base\Object.php(105): yii\BaseYii::configure(Obje
ct(yii\console\Request), Array)
#2 [internal function]: yii\base\Object->__construct(Array)
#3 D:\web\wamp64\www\html\royall.dev\vendor\yiisoft\yii2\di\Container.php(381): ReflectionClass->newInstan
ceArgs(Array)
#4 D:\web\wamp64\www\html\royall.dev\vendor\yiisoft\yii2\di\Container.php(156): yii\di\Container->build('y
ii\\console\\Req...', Array, Array)
#5 D:\web\wamp64\www\html\royall.dev\vendor\yiisoft\yii2\BaseYii.php(344): yii\di\Container->get('yii\\con
sole\\Req...', Array, Array)
#6 D:\web\wamp64\www\html\royall.dev\vendor\yiisoft\yii2\di\ServiceLocator.php(135): yii\BaseYii::createOb
ject(Array)
#7 D:\web\wamp64\www\html\royall.dev\vendor\yiisoft\yii2\console\Application.php(219): yii\di\ServiceLocat
or->get('request')
#8 D:\web\wamp64\www\html\royall.dev\vendor\yiisoft\yii2\base\Application.php(380): yii\console\Applicatio
n->getRequest()
#9 D:\web\wamp64\www\html\royall.dev\yii(27): yii\base\Application->run()
#10 {main}
Why is this happening? I did not have cookieValidationKey inside my console\config\main.php so it should not Popup this error.
I use windows and wamp-server but I tested it on an Ubuntu server and it's returning the same error.
That's because your console command combined all configs before executing the actual action. There are some config params which are invalid to console actions but useful to web requests. The solution is to remove these params before executing console actions.
Add the following line
unset($config['components']['request']);
before
$application = new yii\console\Application($config);
in file yii.
Because I run web server via vagrant, I didn't test if there's side effect to web app run via yii command.

CakePHP and Memcached error - php5.6

I'm trying to migrate our company application from php 5.3 to php 5.6. This app uses cakephp 2.4.3 and memcached, but when I try to execute ./cake bake command, the next error comes up:
Fatal error: Uncaught exception 'CacheException' with message 'Cache engine _cake_core_ is not properly configured.' in /cluster/data/deploy/clickdelivery/current/lib/Cake/Cache/Cache.php:181
Stack trace:
#0 /cluster/data/deploy/clickdelivery/current/lib/Cake/Cache/Cache.php(151): Cache::_buildEngine('_cake_core_')
#1 /cluster/data/deploy/clickdelivery/current/app/Config/core.php(381): Cache::config('_cake_core_', Array)
#2 /cluster/data/deploy/clickdelivery/current/lib/Cake/Core/Configure.php(72): include('/cluster/data/d...')
#3 /cluster/data/deploy/clickdelivery/current/lib/Cake/bootstrap.php(177): Configure::bootstrap(true)
#4 /cluster/data/deploy/clickdelivery/current/lib/Cake/Console/ShellDispatcher.php(136): require('/cluster/data/d...')
#5 /cluster/data/deploy/clickdelivery/current/lib/Cake/Console/ShellDispatcher.php(98): ShellDispatcher->_bootstrap()
#6 /cluster/data/deploy/clickdelivery/current/lib/Cake/Console/ShellDispatcher.php(54): ShellDispatcher->_initEnvironment()
#7 /cluster/data/deploy/clickdelivery/cu in /cluster/data/deploy/clickdelivery/current/lib/Cake/Cache/Cache.php on line 181
Persistent and models directory are created with +W.
Thanks in advance.

Install impresspages to localhost - problems with db connection

When i try to install impresspages on localhost in Database installation i see this:
Can't connect to database.
I try to solve this problem by installing it on hosting(its install with no problems) and then transfer it to localhost with all database, and i edit config file. And when i go to home page i saw this:
Fatal error: Uncaught exception 'Ip\Exception\Db' in C:\www\Apache2\htdocs\ip\Ip\ServiceLocator.php:258 Stack trace: #0 C:\www\Apache2\htdocs\ip\Ip\Db.php(28): Ip\Db->getConnection() #1 C:\www\Apache2\htdocs\ip\Ip\ServiceLocator.php(258): Ip\Db->__construct() #2 C:\www\Apache2\htdocs\ip\Ip\ServiceLocator.php(226): Ip\ServiceLocator::loadService('db') #3 C:\www\Apache2\htdocs\ip\Ip\Functions.php(379): Ip\ServiceLocator::db() #4 C:\www\Apache2\htdocs\ip\Ip\Internal\Plugins\Model.php(316): ipDb() #5 C:\www\Apache2\htdocs\ip\Ip\Internal\Plugins\Service.php(9): Ip\Internal\Plugins\Model::getActivePluginNames() #6 C:\www\Apache2\htdocs\ip\Ip\Dispatcher.php(140): Ip\Internal\Plugins\Service::getActivePluginNames() #7 C:\www\Apache2\htdocs\ip\Ip\Application.php(153): Ip\Dispatcher->_bindApplicationEvents() #8 C:\www\Apache2\htdocs\ip\Ip\Application.php(319): Ip\Application->_handleOnlyRequest(Object(Ip\Request), Array, false) #9 C:\www\Apache2\htdocs\ip\Ip\Application.php(413): Ip\Application->handleRequest(Object(Ip\Request), Ar in C:\www\Apache2\htdocs\ip\Ip\ServiceLocator.php on line 258
Looks like the MySQL extension for PHP is not installed or enabled. See http://php.net/manual/en/mysql.installation.php for more information.

Categories