Need some guidance regarding Elasticsearch php - xampp

I need some help in understanding the following things,
I am using composer for elasticsearch php integration. I have created a html page to post form data into elasticsearch. I am trying to access the html page from another pc by changing the localhost ip to the system ip where i have hosted the html page. But i'm getting error.
Fatal error: Uncaught Elasticsearch\Common\Exceptions\NoNodesAvailableException: No alive nodes found in your cluster in C:\xampp\htdocs\Client_portal\vendor\elasticsearch\elasticsearch\src\Elasticsearch\ConnectionPool\StaticNoPingConnectionPool.php:50 Stack trace: #0 C:\xampp\htdocs\Client_portal\vendor\elasticsearch\elasticsearch\src\Elasticsearch\Transport.php(77): Elasticsearch\ConnectionPool\StaticNoPingConnectionPool->nextConnection() #1 C:\xampp\htdocs\Client_portal\vendor\elasticsearch\elasticsearch\src\Elasticsearch\Transport.php(94): Elasticsearch\Transport->getConnection() #2 C:\xampp\htdocs\Client_portal\vendor\elasticsearch\elasticsearch\src\Elasticsearch\Connections\Connection.php(269): Elasticsearch\Transport->performRequest('POST', '/sib_api/_doc', Array, '{"requestid":"#...', Array) #3 C:\xampp\htdocs\Client_portal\vendor\react\promise\src\FulfilledPromise.php(25): Elasticsearch\Connections\Connection->Elasticsearch\Connections{closure}(Array) #4 C:\xampp\htdocs\Client_portal\vendor\guzzlehttp\ringphp\sr in C:\xampp\htdocs\Client_portal\vendor\elasticsearch\elasticsearch\src\Elasticsearch\ConnectionPool\StaticNoPingConnectionPool.php on line 50
To resolve the above issue i tried to call the autoload.php file using the complete path (i.e) http://localhost:8080/client_portal/vendor/autoload.php
But now I am getting another error
Fatal error: Uncaught Error: Class 'Elasticsearch\ClientBuilder' not found in C:\xampp\htdocs\Client_portal\Elastic_api.php:19 Stack trace: #0 {main} thrown in C:\xampp\htdocs\Client_portal\Elastic_api.php on line 19
Could someone help me to resolve this issue... and also guide me how to access my html page from another system without any isssues.
<?php
session_start();
$Engagement = $_SESSION["Engagement"];
$Application = $_SESSION["Application"];
$Priority = $_SESSION["Priority"];
$Requestid = $_SESSION["Requestid"];
$_SESSION["URL"] = $_POST['url'];
$_SESSION["REQ"] = $_POST['request'];
$_SESSION["RES"] = $_POST['response'];
$_SESSION["yn"] = $_POST['YN'];
$_SESSION["START"] = $_POST['start'];
$_SESSION["END"] = $_POST['end'];
if (isset($_POST['Submit2']))
{
require 'http://localhost:8080/client_portal/vendor/autoload.php';
$client = Elasticsearch\ClientBuilder::create()->build();
// the above line is where i'm getting the error...

Related

Fatal Error When Set CI_DEBUG to False On Production Mode Codeigniter 4

Why I get this error when set from Config/Boot/production.php CI_DEBUG to false in production mode ? this is the default setting from CI4.
defined('CI_DEBUG') || define('CI_DEBUG', false);
Fatal error: Declaration of CodeIgniter\Log\Logger::emergency($message, array $context = []): bool must be compatible with Psr\Log\LoggerInterface::emergency(Stringable|string $message, array $context = []): void in E:\testing\Source Code\testing_CI_v.4.2.6\system\Log\Logger.php on line 157
Fatal error: Uncaught Error: Class "CodeIgniter\Log\Logger" not found in E:\testing\Source Code\testing_CI_v.4.2.6\system\Config\Services.php:391 Stack trace: #0 E:\testing\Source Code\testing_CI_v.4.2.6\system\Config\BaseService.php(253): CodeIgniter\Config\Services::logger(false) #1 E:\testing\Source Code\testing_CI_v.4.2.6\system\Config\BaseService.php(194): CodeIgniter\Config\BaseService::__callStatic('logger', Array) #2 E:\testing\Source Code\testing_CI_v.4.2.6\system\Config\Services.php(388): CodeIgniter\Config\BaseService::getSharedInstance('logger') #3 E:\testing\Source Code\testing_CI_v.4.2.6\system\Config\BaseService.php(253): CodeIgniter\Config\Services::logger(true) #4 E:\testing\Source Code\testing_CI_v.4.2.6\system\Common.php(799): CodeIgniter\Config\BaseService::__callStatic('logger', Array) #5 E:\testing\Source Code\testing_CI_v.4.2.6\system\Debug\Exceptions.php(114): log_message('critical', '{message}\nin {e...', Array) #6 E:\testing\Source Code\testing_CI_v.4.2.6\system\Debug\Exceptions.php(180): CodeIgniter\Debug\Exceptions->exceptionHandler(Object(ErrorException)) #7 [internal function]: CodeIgniter\Debug\Exceptions->shutdownHandler() #8 {main} thrown in E:\testing\Source Code\testing_CI_v.4.2.6\system\Config\Services.php on line 391
For Development And Testing Mode run without problem. This error just occur when using routes->resource (RESTFUL API).
It is not clear what error is this. I try to replace the system folder with new one. But the error still exists.
It is said "Uncaught Error: Class "CodeIgniter\Log\Logger" not found" I don't know what is the problem with this and why it is not found.
Now my app just run with set CI_DEBUG to true to prevent the error. But the default is set to false for production.
defined('CI_DEBUG') || define('CI_DEBUG', true);
What is missing in here ? It is so strange that setting the CI_ENVIRONMENT to development or testing worked without a problem. But for production not working. So I decide to turn on the error display in production mode and found the error above.
Seriously help need.
I found the problem in the restful api.
The problem is in the config/filter.php
$routes->resource('ApiManageTips', ['controller' =>'App\Controllers\ApiData\ApiManageTips']); // get, put, create, delete
public $filters = [
'basicauth' => ['before' =>
[
'ApiManageTips/*',
'ApiManageTips',
]
]
];
The Above example is working in the version 4.1.2 but is not working in version 4.2.6
Instead change to :
public $filters = [
'basicauth' => ['before' =>
[
'ApiManageTips/*',
]
];
I don't why it is not working in the CI Version 4.2.6.

How to upload an image to a specific folder on cloudiary with laravel jrm2k6/cloudder

I want to crop the avatar image and upload that on a specific folder of cloudiary using Laravel jrm2k6/cloudder but faced to a error to upload an image.
Can anyone help me what's wrong or show how to solve?
Following is the error message stored on a log file.
[2019-10-20 10:39:38] local.ERROR: Invalid Signature 22800853dcbe6c9972b65d99946460f1965a6e06. String to sign - 'folder=media/users/1/avatar&timestamp=
1571535576'. {"userId":1,"exception":"[object] (Cloudinary\\Error(code: 401): Invalid Signature 22800853dcbe6c9972b65d99946460f1965a6e06. String to sig
n - 'folder=media/users/1/avatar&timestamp=1571535576'. at /Users/kondonator/Development/tiny-services/vendor/cloudinary/cloudinary_php/src/Uploader.ph
p:515)
[stacktrace]
#0 /Users/kondonator/Development/tiny-services/vendor/cloudinary/cloudinary_php/src/Uploader.php(374): Cloudinary\\Uploader::call_api('upload', Array,
Array, '/private/var/tm...')
#1 /Users/kondonator/Development/tiny-services/vendor/cloudinary/cloudinary_php/src/Uploader.php(99): Cloudinary\\Uploader::call_cacheable_api('upload'
, Array, Array, '/private/var/tm...')
#2 /Users/kondonator/Development/tiny-services/vendor/jrm2k6/cloudder/src/JD/Cloudder/CloudinaryWrapper.php(122): Cloudinary\\Uploader::upload('/privat
e/var/tm...', Array)
#3 /Users/kondonator/Development/tiny-services/vendor/laravel/framework/src/Illuminate/Support/Facades/Facade.php(239): JD\\Cloudder\\CloudinaryWrapper
->upload('/private/var/tm...', NULL, Array, Array)
#4 /Users/kondonator/Development/tiny-services/app/Http/Controllers/UserController.php(150): Illuminate\\Support\\Facades\\Facade::__callStatic('upload
', Array)
#5 [internal function]: App\\Http\\Controllers\\UserController->update(Object(Illuminate\\Http\\Request), '1')
And the following is the code of UserController.php.
$path = $request->file('avatar')
->getRealPath();
$image = Image::make($path);
$image->crop($request->width, $request->height, $request->x, $request->y)
->resize(200, 200)
->save();
$folder = 'media/users/'.$id.'/avatar';
Cloudder::upload($path, null, ['folder' => $folder], []);
$result = Cloudder::getResult();
$avatar = Cloudder::getPublicId();
The last is the part of .env those are from Cloudinary's Dashboard -> Account Details.
CLOUDINARY_API_KEY=XXXXX
CLOUDINARY_API_SECRET=YYYYY
CLOUDINARY_CLOUD_NAME=ZZZZZ
Thanks in advance.
The string (folder=media/users/1/avatar&timestamp=1571535576) prior to the api_secret being concatanated at the end is correct, but the signature it should've produced is 083dc25c1d1e4a90f84336450f21c9fb59b343f5.
I suggest double-checking the CLOUDINARY_API_SECRET in your configuration (.env) and if you've made any changes to it then you should restart your server so they take effect.
What you can also do is manually generate the correct signature on the command line just to double-check with the one that's being thrown as part of the exception. Replace <API_SECRET> with your actual one in the command below:
echo -n "folder=media/users/1/avatar&timestamp=1571535576<API_SECRET>" | sha1sum
Also, not related to the error, but I would recommend keeping your cloud name in all lowercase in your configuration. The API responses would return url and secure_url with it in all lowercase and also that's the case for using the URLs that are generated by the Media Library. Requesting resources with different casing would result in different cache-keys at the CDN.

Magento 1.9 cannot make customer login, undefined offset + undefined variable

I have a really strange problem. Yesterday I was working with magento just fine and today when I opened the pc and tried login on my account after cleaning cache & session it gives me this error on customer login:
Error occurred. Please try again later on the frontend.
I dig into the system.log and I have this:
ERR (3): Notice: Undefined offset: 158 in {...}/phpseclib/Math/BigInteger.php on line 3426 and 3317
ERR (3): Notice: Undefined variable: cmsPageIdentifier in {...}/default/template/page/html/header.phtml on line 29
and this is the code in question
Line 7-10:
if(Mage::app()->getFrontController()->getRequest()->getRouteName() == 'cms')
{
$cmsPageIdentifier = Mage::getSingleton('cms/page')->getIdentifier();
}
Line 29:
<?php elseif ($cmsPageIdentifier && $cmsPageIdentifier == "conferma-invio") : ?>
In sso.log I have this
DEBUG (7): HTTP status: 503 when trying to get user authentication
DEBUG (7): Field Status was empty in webapi response
Thank you.
I manually fixed the BigInteger and I remained only with the sso.log.
Dug into it and I found that there was another module error blocking customer login. Setting that module to false in app/etc/modules/Module_Name.xml fixed it.

php, postgresql and phppgadmin: errors after changes made to files

I was getting deprecated constructor error when I tried installing postgres with xampp. Though I was able to resolve those issues but I am unable to solve the one below. Kindly help to solve this.
Fatal error: Uncaught Error: Call to undefined method ADORecordSet_postgres7::ADORecordSet_postgres64() in C:\xampp\phppgadmin\libraries\adodb\drivers\adodb-postgres7.inc.php:220 Stack trace:
#0 C:\xampp\phppgadmin\libraries\adodb\adodb.inc.php(1055): ADORecordSet_postgres7->__construct(Resource id #19, 2)
#1 C:\xampp\phppgadmin\libraries\adodb\adodb.inc.php(1015): ADOConnection->_Execute('select version(...', false)
#2 C:\xampp\phppgadmin\libraries\adodb\adodb.inc.php(1427): ADOConnection->Execute('select version(...', false)
#3 C:\xampp\phppgadmin\libraries\adodb\drivers\adodb-postgres64.inc.php(129): ADOConnection->GetOne('select version(...')
#4 C:\xampp\phppgadmin\libraries\adodb\drivers\adodb-postgres64.inc.php(697): ADODB_postgres64->ServerInfo()
#5 C:\xampp\phppgadmin\libraries\adodb\adodb.inc.php(525): ADODB_postgres64->_connect('host='localhost...', ''postgres'', ''password'', ''template1'')
#6 C:\xampp\phppgadmin\classes\database\Connection.php(42): ADOConnection->Connect('localhost:5432:...', 'postgres', ' in C:\xampp\phppgadmin\libraries\adodb\drivers\adodb-postgres7.inc.php on line 220
You should also change the constructor in adodb-postgres7.inc.php by replacing
function ADODB_postgres7()
with
function __construct()

" URL not found 404 error" after the 3rd page during Magento installation

I have been trying to install Magento 1.6 latest version and sample data magento sample-data- 1.1.2 but all in vain.I cannot get past the 3rd page,where database,username,URL etc information is added.When I click the continue button,I get 404 error “URL not found“ .After google search I found out that some guys reported similar problems that lead to some php files accessing the Mysql server.Those files seemed to have a syntax error of some kind.My problem is of similar nature but leads to a diffrent php file having an 'an access voilation'error.The url points to the report directory inside magento/var.
This is my report file in Public_html/magento/var/report
a:5:{i:0;s:223:"Error in file: "/home/archy/public_html/magento/app/code/core/Mage/Directory/sql/directory_setup/mysql4-upgrade-0.8.2-0.8.3.php" - SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'AX' for key 'PRIMARY'";i:1;s:1022:"#0 /home/archy/public_html/magento/app/code/core/Mage/Core/Model/Resource/Setup.php(645): Mage::exception('Mage_Core', 'Error in file: ...')
I don’t understand how to solve the problem.Has anyone experienced similar problems.
New Addition..
I am really struggling with Magento!! I tried to install magento on my desktop(local server) after a failed attempt on my laptop(above).But I get I "Object not found error 404" after clicking the continue button in the configuration section of my installation.I have double checked my permissions on media, var,app directories.They are all 777.Sample date was installed before starting installation.The only option that I commented out in .htaccess was the the ExpireDefault which was causing "Internal Server Error"before being removed.
Here is the stack trace:
Mage_Core_Exception: Can't retrieve entity config: sales/quote_shipping_rate in /home/sam/public_html/magento/app/Mage.php on line 563
Call Stack:
0.0296 644264 1. {main}() /home/sam/public_html/magento/index.php:0
0.1808 1129872 2. Mage::run() /home/sam/public_html/magento/index.php:80
0.3326 2771544 3. Mage_Core_Model_App->run() /home/sam/public_html/magento/app/Mage.php:640
1.0335 4165088 4. Mage_Core_Model_App->_initModules() /home/sam/public_html/magento/app/code/core/Mage/Core/Model/App.php:338
5.2513 4490984 5. Mage_Core_Model_Resource_Setup::applyAllUpdates() /home/sam/public_html/magento/app/code/core/Mage/Core/Model/App.php:412
7.1161 9860936 6. Mage_Core_Model_Resource_Setup->applyUpdates() /home/sam/public_html/magento/app/code/core/Mage/Core/Model/Resource/Setup.php:235
7.1163 9861520 7. Mage_Core_Model_Resource_Setup->_upgradeResourceDb() /home/sam/public_html/magento/app/code/core/Mage/Core/Model/Resource/Setup.php:320
7.1163 9861600 8. Mage_Core_Model_Resource_Setup->_modifyResourceDb() /home/sam/public_html/magento/app/code/core/Mage/Core/Model/Resource/Setup.php:437
7.1792 9917352 9. include('/home/sam/public_html/magento/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.9.16-0.9.17.php') /home/sam/public_html/magento/app/code/core/Mage/Core/Model/Resource/Setup.php:624
7.1810 9918112 10. Mage_Sales_Model_Resource_Setup->addAttribute() /home/sam/public_html/magento/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.9.16-0.9.17.php:32
7.1810 9918112 11. Mage_Sales_Model_Resource_Setup->_flatTableExist() /home/sam/public_html/magento/app/code/core/Mage/Sales/Model/Resource/Setup.php:101
12.4649 9964680 12. Mage_Core_Model_Resource_Setup->getTable() /home/sam/public_html/magento/app/code/core/Mage/Sales/Model/Resource/Setup.php:87
12.4649 9964680 13. Mage_Core_Model_Resource->getTableName() /home/sam/public_html/magento/app/code/core/Mage/Core/Model/Resource/Setup.php:184
12.5666 10576032 14. Mage::throwException() /home/sam/public_html/magento/app/code/core/Mage/Core/Model/Resource.php:272
)
I couldn't find out what could have caused the problem.Help needed.
Thank you.
Check with the below script if your server or local meets the requirement to install magento
function extension_check($extensions) {
$fail = '';
if(version_compare(phpversion(), '5.2.0', '<')) {
$fail .= '<li>PHP 5.2.0 (or greater)</li>';
}
if(!ini_get('safe_mode')) {
if(preg_match('/[0-9].[0-9]+.[0-9]+/', shell_exec('mysql -V'), $version)) {
if(version_compare($version[0], '4.1.20', '<')) {
$fail .= '<li>MySQL 4.1.20 (or greater)</li>';
}
}
}
foreach($extensions as $extension) {
if(!extension_loaded($extension)) {
$fail .= '<li>'.$extension.'</li>';
}
}
if($fail) {
echo '<p>Your server does not meet the requirements for Magento.';
echo 'The following requirements failed:</p>';
echo '<ul>'.$fail.'</ul>';
} else {
echo '<p>Congratulations! Your server meets the requirements for Magento.</p>';
}
}
?>
STEP 2 : CHeck Max Execution time
Step 3: Install the Magento again with the version 1.6.0.0 as there were some problem at the first release or try with latest version 1.6.2.0
Let me know if it works or not

Resources