Fatal error on phpMyAdmin - codeigniter

I want to configure my database on CI but I have a problem
How can i fix it?
I'm using CI 2.x
And
phpMyAdmin-4.6.6-english

As I can check your using wrong database settings in your database.php file.
If your php version is equals to php 5.5 or above you have to use
$db['default']['dbdriver'] = 'mysqli';
instead of
$db['default']['dbdriver'] = 'mysql';
and also put your database username and password in setting to avoid this error.
I recommend you to use codeigniter 3 the latest version .

Related

Laravel migration cannot find driver when using sqlsrv database in windows

I am using sqlsrv database connection in my project as I need to connect to Microsoft SQL Database.
I have successfully installed the sqlsrv driver because I can connect to the Database to retrieve data.
But when I try to do the Laravel Migration, it shows an error:
Illuminate\Database\QueryException : could not find driver (SQL: select * from sysobjects where type = 'U' and name = migrations)
Below is my .env
DB_CONNECTION=sqlsrv
DB_HOST=**********.database.windows.net
DB_PORT=1433
DB_DATABASE=****************_4cd1_9d18_2a7d9ddbcd13
DB_USERNAME=***************_4cd1_9d18_2a7d9ddbcd13_ExternalWriter
DB_PASSWORD=***************
php.ini
extension=php_xmlrpc.dll
extension=php_xsl.dll
extension=php_pdo_sqlsrv_7_nts_x64.dll
extension=php_pdo_sqlsrv_7_nts_x86.dll
extension=php_pdo_sqlsrv_7_ts_x64.dll
extension=php_pdo_sqlsrv_7_ts_x86.dll
extension=php_pdo_sqlsrv_71_nts_x64.dll
extension=php_pdo_sqlsrv_71_nts_x86.dll
extension=php_pdo_sqlsrv_71_ts_x64.dll
extension=php_pdo_sqlsrv_71_ts_x86.dll
extension=php_sqlsrv_7_nts_x64.dll
extension=php_sqlsrv_7_nts_x86.dll
extension=php_sqlsrv_7_ts_x64.dll
extension=php_sqlsrv_7_ts_x86.dll
extension=php_sqlsrv_71_nts_x64.dll
extension=php_sqlsrv_71_nts_x86.dll
extension=php_sqlsrv_71_ts_x64.dll
extension=php_sqlsrv_71_ts_x86.dll
How to use SQL Server DLL files with PHP 7.2 version on xampp
https://github.com/Microsoft/msphpsql/releases
To download Windows DLLs for PHP 7.1 or above from the PECL repository, please go to the SQLSRV or PDO_SQLSRV PECL page.
https://pecl.php.net/package/sqlsrv/5.6.1/windows
https://pecl.php.net/package/pdo_sqlsrv/5.6.1/windows
NOTE: Do not forget to remove 'php_' prefix when you add extension dll filename in php.ini file. eg.
extension=pdo_sqlsrv
extension=sqlsrv
Do not change actual filename which you put in /xampp/php/ext/ directory.
"7.2 Thread Safe (TS) x86" worked for me for 'sqlsrv' and 'pdo_sqlsrv' extensions.
Restart xampp or apache then you can see enabled 'pdo_sqlsrv' extension when you print phpinfo() in a test php file
It was very hard to find this solution. I hope, this will also help you. All the best :)
You may need to upgrade your PHP version to PHP 7.1.
Now make sure that the files config/database.php and .env are configured properly.
See this one: https://laracasts.com/discuss/channels/general-discussion/connect-laravel-to-microsoft-sql
After fighting with it for a while found a solution :
you need to downloaded it from here then extract the files in your php folder
For PHP 7.4 on Windows 10 (x64), I've solved same error s below:
Downloaded the driver from
https://www.microsoft.com/en-us/download/details.aspx?id=20098
Extracted the archive and copied the file
php_pdo_sqlsrv_74_ts_x64.dll to the ext folder (C:\Program Files\php74\ext in my setup)
Added extension=php_pdo_sqlsrv_74_ts_x64.dll into php.ini file
In my .env file I've DB_CONNECTION=sqlsrv so I first thought php_sqlsrv_74_ts_x64.dll should be used but it didn't work.

How to install package spatie pdf to img in laravel 5.5?

I already install GhostScript and imagick and it's working well in php artisan, now when i install this package Spatie/pdf-to-image it does not have service provider and alias in installation steps. Can you guys help me how to install this package and make it work?
Not Working:
Working in php artisan:
I also try this one and doesn't work:
$pdf = new Spatie\PdfToImage\Pdf('public/test/test.pdf');
$pdf = new \Spatie\PdfToImage\Pdf('public/test/test.pdf');
Here's my composer:
Try again with:
$pdf = new \Spatie\PdfToImage\Pdf('public/test/test.pdf');
Previous error was caused because of wrong namespace. It's better to add Spatie\PdfToImage\Pdf to use section at the top of document and then in code just write $pdf = new Pdf('path/to/pdf');
You first run this command on CMD :
composer require spatie/pdf-to-image
After add this lines in your controller
use Spatie\PdfToImage\Pdf;
$pdf = new Pdf($pathToPdf);
$pdf->saveImage($pathToWhereImageShouldBeStored);

laravel-localization hide default locale

I'm using Laravel-Localization 1.2.6 in Laravel 5.3
When I set:
hideDefaultLocaleInURL = true
It's not working.
locale is set to 'sk'
fallback_locale is set to 'sk'
But I can access both domain.app & domain.app/sk
Also when I switch language to SK language code is still in URL.
Everything else is working fine... Any suggestions?
Just clean your config cache
php artisan config:cache

Auth guard driver [api] is not defined?

I use this library jwt-auth-guard in Laravel 5.3.
When I try open page I get error:
InvalidArgumentException in AuthManager.php line 99:
Auth guard driver [api] is not defined.
How can I fix it? I made everything that was need
I'm not sure, please check you guard driver setup into config/auth.php first. You can cross check this from GIT repo.
Let me know if any concern from above.
If you are using tymondesigns/jwt-auth package first check that you are downloading the latest version (1.0.0-rc.2 for this time) or you can just update your composer
composer update
and also delete your old jwt file from config folder and publish again also run!
php artisan jwt:secret

LAMP Laravel ErrorException mcrypt_get_iv_size(): Module initialization failed

I installed laravel in my new pc and i'm getting this error:
ErrorException mcrypt_get_iv_size(): Module initialization failed
I copied the project from my old pc. mcrypt is installed and enabled, and other pages that do not use laravel are working. I'm running ubuntu 14.04
I created a new laravel project (using laravel new command) and when i try to access i get:
"Whoops, looks like something went wrong."
I opened the log and the error was:
production.ERROR: exception 'ErrorException' with message
'mcrypt_get_iv_size(): Module initialization failed
any ideas?
On app/config/app.php just change:
'cipher' => MCRYPT_RIJNDAEL_256,
Run php artisan key:generate on your command line to refresh your application key.
Then clear your cache and sessions and try again.
I had this same problem today, and it was because of how Laravel 4.2 uses the new encryption method.
Make sure you run php 7.0, and add this string "MCRYPT_RIJNDAEL_256" (without the quotes) to the cipher in app.php. after generate a new key (php artisan key:generate) and add the new key.
This works for me.
Another solution:
Add "tomgrohl/laravel4-php71-encrypter": "^1.1" to the require of your composer.json
Run composer update
Add 'AES-256-CBC' to the cipher in app/config/app.php
Done!

Resources