Thursday 21 April 2016

LARAVEL Common Issues

As per my experience I found following general issues and people struggling with those. For their simplicity, I am mentioning steps to get rid of such issue:


Laravel: Error [PDOException]: Could not Find Driver

This is general error and you face this while working with LAMPP./XAMPP. Possible reason for error is your driver path is not found. You are using LAMPP and your mysql driver path is could be like /opt/lampp/bin/ etc. If you check your system you will find another PHP/MySQL is installed in usr/bin and laravel try to find path inside /usr/bin, hence no path found.

Possible work around:
check your path with $PATH command in terminal

To add /opt/lampp/bin run following command in terminal:
export PATH=/opt/lampp/bin:$PATH
Above command will add lampp path and from now your lampp directory search first.


Laravel: Connection was reset / No data received

This error means no data received from servver. Possible cause for this is your installed unwanted plugins like xcache, using multiline laravel comments

Solution:

Try to check phpinfo, if xcache installed, turn off/disable xcache or add following line in your htaccess

php_flag eaccelerator.enable 0
php_flag eaccelerator.optimizer 0
php_flag xcache.cacher 0
Another work around for this is to avoid laravel cache much as possible and use php comments.


Laravel: Install on shared hosting / Work without virtual host

Many used to think that laravel works only on dedicated servers and not shared hosting. You needs to create virtual host to work with on local etc.

Laravel works well with shared hosting and you can work with laravel without creating virtual host too. Try following steps to configure laravel without shared hosting:

Steps:
  • Copy server.php file and rename to index.php
  • Copy .htaccess file from public/ directory and place into root server
You are done.


Laravel: Failed to open stream: Permission denied

This error suggests that your storage/ directory is not writtable and you need to make it writable. Simply assign 777 permission to make it work properly.

If you are linux user you can use following command:

go to storate parent directory and type chmod 777 -Rf storage


You all welcome to comment your issues and help others.