Config File Loads Twice - codeigniter

I'm using codeigniter. Suddenly, for some reason, my application/config/config.php started loading twice.
I have the following code at the top of config file, starts from line 5 to line 12:
function __autoload ($class) {
$file = APPPATH . 'libraries/' . $class . EXT;
if (strpos($class, 'CI_') !== 0) {
if (file_exists($file) && is_file($file)) {
#include_once (APPPATH . 'libraries/' . $class . EXT);
}
}
}
When i test a page, i get this error:
Fatal error: Cannot redeclare __autoload() (previously declared in C:\xampp\htdocs\ci_centric\application\config\config.php:5) in C:\xampp\htdocs\ci_centric\application\config\config.php on line 12
If i wrap the autoload with if(!function_exists('__autoload')) { ... }, i get the following output:
Notice: Constant FRONTEND_PATH already defined in C:\xampp\htdocs\ci_centric\application\config\config.php on line 390
Notice: Constant FRONTEND_WEBPARTS_PATH already defined in C:\xampp\htdocs\ci_centric\application\config\config.php on line 391
Notice: Constant FRONTEND_MAINPAGES_PATH already defined in C:\xampp\htdocs\ci_centric\application\config\config.php on line 392
Notice: Constant BACKEND_PATH already defined in C:\xampp\htdocs\ci_centric\application\config\config.php on line 393
Notice: Constant BACKEND_WEBPARTS_PATH already defined in C:\xampp\htdocs\ci_centric\application\config\config.php on line 394
Notice: Constant BACKEND_MAINPAGES_PATH already defined in C:\xampp\htdocs\ci_centric\application\config\config.php on line 395
Notice: Constant BACKEND_MAINPAGES_PATH already defined in C:\xampp\htdocs\ci_centric\application\config\config.php on line 396
.
.
.
Everything used to work fine for days; i played little bit with $this->session->flashdata('...'); then i got the config double loading problem.
Any help will be appreciated...

Well, I don't know what kind of hacks do you use, and WHY do you do such things in a configuration file, where only variables should be declared. You should remove that code or better even start from a fresh copy of CodeIgniter. You don't know where and for what purpose CodeIgniter wants to load this file twice. Anyway, you should not do such things by any means. If it's really necessary for some awkward reason, you can try moving this to MY_core.php or even index.php file, it's still will be totally wrong, but much better than what you have right now.

Related

Why won't Scilab open an image file?

I am trying to work with image files under Scilab, and I get stuck at the very beginning, unable to load an image file.
I have searched the help system as well as the Web, tried two versions of Scilab (because some of the answers I found say that 6.0 is incompatible with some image functions) and still drew a blank. Whatever I try, the imread function is simply not there.
Here is what I get:
Under Scilab 6.0.2:
--> clear
--> atomsSystemUpdate()
Scanning repository http://atoms.scilab.org/6.0 ... Done
--> atomsInstall("SIVP")
atomsInstallList: The package "SIVP" is not registered.
Please check on the ATOMS repository that it is available for Scilab 6.0 on Windows.
If it is, run atomsSystemUpdate() before trying atomsInstall(..) again.
at line 52 of function atomsError ( C:\Program Files\scilab-6.0.2\modules\atoms\macros\atoms_internals\atomsError.sci line 66 )
at line 78 of function atomsInstallList ( C:\Program Files\scilab-6.0.2\modules\atoms\macros\atoms_internals\atomsInstallList.sci line 117 )
at line 233 of function atomsInstall ( C:\Program Files\scilab-6.0.2\modules\atoms\macros\atomsInstall.sci line 249 )
--> atomsInstall("IPCV")
ans =
[]
--> disp( atomsGetInstalled() );
!IPCV 4.1.2 user SCIHOME\atoms\x64\IPCV\4.1.2 I !
--> im=imread("Kratka220.tif")
Undefined variable: imread
Under Scilab 5.5.2:
-->clear
-->atomsSystemUpdate()
Scanning repository http://atoms.scilab.org/5.5 ... Done
-->atomsInstall("SIVP")
ans =
[]
-->atomsInstall("IPCV")
atomsInstallList: Pakiet IPCV nie jest dostępny.
<this is Polish for "Package IPCV is not available"; I installed 5.5.2 in Polish>
!--error 10000
at line 51 of function atomsError called by :
at line 76 of function atomsInstallList called by :
at line 233 of function atomsInstall called by :
atomsInstall("IPCV")
-->disp( atomsGetInstalled() );
column 1 to 4
!SIVP 0.5.3.2 user SCIHOME\atoms\x64\SIVP\0.5.3.2 !
column 5
!I !
-->im=imread("Kratka220.tif")
!--error 4
Niezdefiniowana zmienna: imread
<this is Polish for "undefined variable">
What am I doing wrong?
After atomsInstall you have to restart Scilab to load the toolbox.

Laravel API Authentication (Passport); ErrorException in CryptKey.php

ErrorException in CryptKey.php line 57:
Key file "file://C:\wamp\www\project\public_html\storage\oauth-private.key" permissions are not correct, should be 600 or 660 instead of 666
My Configuration as follows:
Windows 10 64bit
WampServer 3.1.0
Apache 2.4.27
PHP 7.0.23
Laravel Framework version 5.3.31
composer require laravel/passport=~1.0
Any idea how to solve it?
You can turn off file checking permissions on line 57
your CryptKey Path is vendor/league/oauth2-server/src/CryptKey.php
on line number 48 turn it to false or comment the following block in your CryptKey.php
if ($keyPermissionsCheck === true) {
// Verify the permissions of the key
$keyPathPerms = decoct(fileperms($keyPath) & 0777);
if (in_array($keyPathPerms, ['600', '660'], true) === false) {
trigger_error(sprintf(
'Key file "%s" permissions are not correct, should be 600 or 660 instead of %s',
$keyPath,
$keyPathPerms
), E_USER_NOTICE);
}
}
keyPermissionsCheck set it to false.
Hope this helps.
Simply CHMOD the oauth-private.key file to 600 or 660. I see that you use Windows so you can surely follow the directions in this post to do that.

tcpdf with laravel 5

i want to save the output pdf file to public folder my method is
public function qrSVG()
{
$qrCodes = ['4659284fff','465928447','465928447','613271980','484016586','aaaaabbbbbccccc'];
$id = ['201596400-1','201596400-2','201596400-3','831070646','493130428','aaaaabbbb'];
PDF::SetTitle('qrcodes\test');
$i=0;
foreach(array_chunk($qrCodes, 2) as $qrCodee)
{
PDF::AddPage();
$m = 55;
$n = 30;
foreach($qrCodee as $qr)
{
QrCode::size(400);
QrCode::margin(3);
QrCode::errorCorrection('H');
QrCode::encoding('UTF-8');
QrCode::backgroundColor(255,255,255);
QrCode::color(0,0,0);
QrCode::imageTitle($id[$i]);
$svg = QrCode::generate($qr);
PDF::ImageSVG('#'.$svg, $x=$m, $y=$n, $w='100', $h='100', $link='', $align='', $palign='', $border=1, $fitonpage=false);
$i++;
$n = 150;
}
}
ob_clean();
PDF::Output('qrcodes\test.pdf');}
this code generate and open the file put don't save it when i replace the last line in my code with PDF::Output('qrcodes\test.pdf', 'F');
when i put any option with PDF::Output there is an error with F and D options the error when use F is
ErrorException in tcpdf_static.php line 2440:
fopen(): remote host file access not supported, file://qrcodes\test.pdf
and when i replace the last line with
PDF::Output($_SERVER['DOCUMENT_ROOT'] . 'qrcodes\test.pdf', 'F');
the error is
ErrorException in tcpdf.php line 2793:
Undefined property: Elibyy\TCPDF\Pdf::$h
The main reason you're getting the error about remote host file access not supported is because you need to provide the full path in the file name that you provide to the Output() method. Yeah, it's a bit annoying and it catches me out all the time!
I can't comment on the second error you're getting because I cannot get your code to run (missing methods in QrCode class). What version are you using? Also, why are you trying to create an SVG for the QR code and then adding that to the PDF? Instead of taking that approach, I would highly recommend following the approach illustrated in this example:
https://github.com/tecnickcom/TCPDF/blob/master/examples/example_050.php
As you will see in the example, you should create an instance of the TCPDF class and then work with that instance, rather than calling the static methods.

opencart Notice: Trying to get property of non-object in

I installed opencart in my server hosting. But the site shows the lines given below.
My site is http://fruitsclubbd.com/
Is it problem of server or opencart?
Notice: Trying to get property of non-object in /home8/fruitscl/public_html/index.php on line 52
Notice: Trying to get property of non-object in /home8/fruitscl/public_html/index.php on line 61
Warning: Invalid argument supplied for foreach() in /home8/fruitscl/public_html/index.php on line 61
Notice: Trying to get property of non-object in /home8/fruitscl/public_html/index.php on line 69
Here is the lines of index.php form line 40 to 70.
// Application Classes
require_once(DIR_SYSTEM . 'library/customer.php');
require_once(DIR_SYSTEM . 'library/affiliate.php');
require_once(DIR_SYSTEM . 'library/currency.php');
require_once(DIR_SYSTEM . 'library/tax.php');
require_once(DIR_SYSTEM . 'library/weight.php');
require_once(DIR_SYSTEM . 'library/length.php');
require_once(DIR_SYSTEM . 'library/cart.php');
// Registry
$registry = new Registry();
// Loader
$loader = new Loader($registry);
$registry->set('load', $loader);
Are you trying to use mysqli? If so, edit both of your config files on the DB_DRIVER line and change it from mysql to mysqli. All what probably happened was choosing mysqli instead of mysql during the installation.

Laravel 4 - Warning: Illegal offset type in isset or empty in \bootstrap\compiled.php

I'm having a hard time installing Laravel 4 on Windows 8 + Xampp.
Here's the setup:
- Xampp 1.8.1
- Composer is installed globally
I install Laravel with the usual "composer create-project laravel/laravel projectname". It installs fine.
But when I navigate to the public folder of the framework, I get dozens of Warning: Illegal offset type in isset or empty in \bootstrap\compiled.php errors.
On lines : 439, 221, 137, 154. The 4 errors are repeated indefinitely until the request times out.
Troubleshooting done so far:
- Tried on 2 seperate machines with the same setup.
- Re-ran Composer update.
- Instead of using create-project, I downloaded the framework and ran Composer install.
- Tried to setup up virtual hosts instead of accessing localhost/projectname/public.
- Searched online for 2 hours. Read every Laravel 4 install tutorial.
Any clues on what I might be doing wrong?
Thanks
-- EDIT --
Here are the lines causing the problem inside of compiled.php
Line 137 section :
$abstract = $this->getAlias($abstract);
if (isset($this->instances[$abstract])) {
return $this->instances[$abstract];
}
Line 154 section :
protected function getConcrete($abstract)
{
if (!isset($this->bindings[$abstract])) {
return $abstract;
} else {
return $this->bindings[$abstract]['concrete'];
}
}
Line 221 section :
protected function getAlias($abstract)
{
return isset($this->aliases[$abstract]) ? $this->aliases[$abstract] : $abstract;
}
Line 439 section :
public function make($abstract, $parameters = array())
{
if (isset($this->deferredServices[$abstract])) {
$this->loadDeferredProvider($abstract);
}
return parent::make($abstract, $parameters);
}
-- NEW FIND --
Using Wampserver works, instead of using Xampp.
Encountered the same error when using Xampp. I fixed it by disabling the eAccelerator extension in php.ini. Try commenting out the following line: zend_extension = "path\to\xampp\php\ext\php_eaccelerator_ts.dll" in your php.ini file.

Resources