In Laravel - could not find driver on xampp using ubuntu 16.04 - laravel

I am working on xampp 7.3 version of PHP.
I am facing the below error.
Illuminate\Database\QueryException: could not find driver (SQL: select name from table where id = e690ddc2-a2b6-4aad-8a73-dab1771c0ea6 limit 1) in file /opt/lampp/htdocs/ProjectFolder/vendor/laravel/framework/src/Illuminate/Database/Connection.php on line 669
Also, I have uncommented the pdo_mysql.dll in php.ini file it still giving me an error.
Also, it is working in the windows system but not in Ubuntu16.04.
how can solve this?

You should install the necessary packages
sudo apt-get install php*-mysql
Then uncomment the MySQL extensions on php.ini and restart your server
sudo service apache2 restart
In your project set the correct parameters and in the root of your project run
php artisan config:cache

I resolve this issue on Ubuntu 18.04 by:
"Control C" out of the php artisan serve command to stop the application.
Stop all the servers running on XAMPP -> (Apache, MySQL and ProFTPD).
Enable mysql inside of XAMPP via path $ cd /opt/lampp/etc .
$ sudo nano php.ini or open in your choice of text editor. I use PHPStorm.
Search for "php_mysql.dll".
Removed the ";" in front of ";extension=php_mysql.dll" -> hit save.
Back in the terminal -> $ cd.. back one folder into the /opt/lampp.
Run $ sudo apt-get install php*-mysql. -> Could take a couple minutes based on your internet connection.
After the install is complete -> restart all the XAMPP servers.
Run $ php artisan config:cache.
Run $ php artisan serve.

Related

How to run laravel artisan command on server?

How to run laravel artisan command on server? I have to run this this command:
composer require realrashid/sweet-alert
If you have access for ssh, login through it.
Check if you have composer by typing composer in terminal else install it.
to Install composer use composer install command in terminal.
go to the root folder in which laravel is installed using cd command.
In the root folder, run the command php artisan in terminal.
It should work fine now.
What if you have Shared hosting?
Just look for terminal in cpanel. See image for ref..
Open it and try for the steps given above.
Thank you!

Laravel 5.5 "Class 'PDO' not found"

Here is the actual error when I open the site
Actually, I have successfully run php artisan migrate:refresh, and there is no error.
Already tried the following command.
php artisan cache:clear
php artisan config:clear
composer install
composer clearcache
composer dump-autoload
php artisan clear-compiled
I also checked if pdo is installed, thru php -m and its already installed
I'm using CentOS.
What is most likely happening here is that the PDO module is enabled in the php-cli config (hence it works from command line), but is not enabled on the web server configuration file.
I am adding all possible options which can solve the issue
Add use PDO; after your namespace or just before your class or at the top of your PHP file
As you are using centOS try the below commands
yum install php-pdo
yum install php-pdo_mysql
service httpd restart
If still its not solved check the php.ini file path to see which is being loaded in the phpinfo() output.
Sometimes there are two different PHP versions installed on a machine, one for CLI and one for the web server.
Restart your apache, nginx, php-fpm
Run <?php phpinfo(); ?> and find out the /path/to/php.ini
Open php.ini
sudo nano /path/to/php.ini
Add these lines to enable the extensions
extension=openssl
extension=pdo_firebird
extension=pdo.so
extension=pdo_mysql
extension=pdo_oci
extension=pdo_odbc
extension=pdo_pgsql
extension=pdo_sqlite
Restart the server
sudo apachectl restart

How to install composer - Missing openssl

I have read How to enable PHP's openssl extension to install Composer? and You must enable the openssl extension to download files via https
They both state that the php file needs to uncomment extension=php_openssl.dll from the php.ini files which live in both these folders:
C:\wamp64\bin\apache\apache2.4.17
C:\wamp64\bin\php\php7.0.0
C:\wamp64\bin\php\php5.6.16 ' I don't think I need to, but did it any way
I've done that, and then restarted the PC.
WAMP is running on my Windows 10 machine
The same error always shows when trying to install Composer
Some settings on your machine make Composer unable to work properly.
Make sure that you fix the issues listed below and run this script again:
The openssl extension is missing, which means that secure HTTPS transfers are impossible.
If possible you should enable it or recompile php with --with-openssl
What do I need to do to install Composer?
Edit
From C:\PHP (the PHP folder) I started a command prompt and ran php -r "phpinfo();"
In the results, there is the following:
OpenSSL support => disabled (install ext/openssl)
I have followed http://php.net/manual/en/faq.installation.php#faq.installation.addtopath
You have multiple version of PHP installed:
C:\wamp64\bin\php\php7.0.0
C:\wamp64\bin\php\php5.6.16
C:\PHP
The PHP version, which you run on the CLI is based on your environment PATH variable. The first PHP path wins.
run php --ini on the CLI. It will show you which php.ini is included and also the path of PHP
edit this php.ini file and activate the extension=php_openssl.dll
then run php -m to check, if the extension is loaded
then run composer

Laravel Migration Error :: PDOException, Could not find driver

I am trying to make a laravel and stucked when migration. when i enter php artisan migrate in terminal, showing PDOException error. attaching my screenshot of terminal and phpinfo.
What i sthis issue, How can i solve this,
I am using Xampp.
Anybody please help me.
Thanks
Try re-installing Xampp? You could use Laravel homestead for a virtual machine, it makes sure you have the proper PHP version and the required dependencies needed to install and avoids having to run Xampp or MAMP or WAMP or any of the amps.
It looks like Xampp cannot find: /usr/lib/php5/20121212/php_pdo_mysql.dll, so make sure that file exists.
You may need to re-install PHP PDO on your machine, refer to: http://php.net/manual/en/pdo.installation.php
Also per PHP docs:
PDO and all the major drivers ship with PHP as shared extensions, and
simply need to be activated by editing the php.ini file:
extension=php_pdo.dll
Please check you have installed more than one php version in your system, one is running for web server and another for php CLI, using PHP_INFO for web and php --ini in commandline, if different version found then upgrade or downgrade means make it one version configuration, and make sure PDO is enable in your system.
From php5.6 to php7.0:
Apache:
sudo a2dismod php5.6 ; sudo a2enmod php7.0 ; sudo service apache2 restart
CLI:
sudo update-alternatives --set php /usr/bin/php7.0
From php7.0 to php5.6:
Apache:
sudo a2dismod php7.0 ; sudo a2enmod php5.6 ; sudo service apache2 restart
CLI:
sudo update-alternatives --set php /usr/bin/php5.6

Install Laravel framework on WAMP

I have been trying to install Laravel framework on WAMP.
I been following the steps from http://laravel.com/
and Installing Laravel 4.1 in Windows 7 // Make .phar file globally available to windows command line
When i run the command
composer create-project laravel/laravel --prefer-dist , getting the error message
[RuntimeException]
You must enable the openssl extension to download files via https
But i have enabled openssl in php.ini by removing the comment sign.
Please help
If you are using WAMPServer here is the problem:
WAMPServer's PHP CLI ( Command Line Interface ) i.e. running php.exe from command line uses a different php.ini to the one used by PHP in Apache.
Edit \wamp\bin\php\php5.x.y\php.ini
Activate the extensions you require the PHP CLI to have access to in the usual way i.e. remove the comment ';' from the extension=php_xxxx.dll line.
Wamp uses 2 php.ini
first one that you changed from the Wamp panel and second one that located on Apache folder.
i think on the wamp/bin/apache/bin make sure to enable openssl on both and restart the Wamp.
This worked for me. Hope this helps you.
Install Laravel Framework in Windows *PHP version greater than
5.3.7 is required.
Download Laravel from: https://github.com/laravel/laravel/archive/master.zip.
Extract Laravel into the www folder for WAMP.
Download Composer from: https://getcomposer.org/Composer-Setup.exe
Enable openssl from all php.ini files
Install Composer into the same directory php.exe is located.
Click on WAMP icon->PHP->PHP Extensions and enable: php_openssl, php_curl, php_socket.
Click on wamp icon->Apache->Apache Modules and enable ssl_module
Open cmd.
Change into the directory where you extracted Laravel e.g: cd C:\wamp\www\laravel.
Type the command: composer install.
Installation completed.
Open httpd.conf file
Add these lines after Include "c:/wamp/alias/"*
Listen 8000
DocumentRoot c:/wamp/www/laravel/public
Open Browser and go to localhost:8000
You follow given Only 1 step and install laravel 5 and composer in your machine
[1]Paste this in cmd : composer create-project laravel/laravel
when you run above command it will automatically install composer and laravel
OPTIONAL:
if error your configuration does not allow connection to
http//packages.firegento.com in cmd follow this command :
composer config -g secure-http false

Resources