Lumen Artisan Issue: No memcached servers added - php

I have just begun to work in a working project. I was trying to mount a docker-compose set of servers for DB, Lumen, and more. When I try some command involving artisan (just like php artisan --versionor php artisan migrate) I get the error message:
No memcached servers added
Well, then I go to Laravel docs to see how memcached cache driver works and it says that this is configured in config/cache.php. Well, this project has no cache.php file. In the other hand, the .env file does not contain CACHE_DRIVER environment variable.
I tried mounting a memcached server dockerized, but still same error. Where can I configure the memcached server nor socket in the project if I don have any configuration related to memcached???
Could this be happening 'cause Laravel finds no cache configuration and it selects any driver with no configuration?

Finally I could reach the solution by myself. Thanks everybody for watching.
When a Lumen project has no .env file configuration files gets some strange configurations. In this case was using memcached as server driver.
Solution: Create a .env file and set the cache driver.

Related

Laravel 5.8 is not always updating newly written code

I'm running a Laravel 5.8 project on PHP 7.2 and I use PhpStorm is my editor on Mac OS 10.15.4.
Since recent, when I write new code, most of the time in a Class, my changes do not take effect in the application itself. PhpStorm and other editors show my new or edited code, but nothing changes in my application. The only thing that solves this issue is a full reboot of my computer. Doing a full reboot and starting everything up again takes a lot of time and time is precious.
What I have tried other than a full reboot:
Restarting PHP
Restarting Nginx
Restarting PhpStorm
Restarting using valet restart
Removing the project and cloning from git repo again
Clearing my config > php artisan config:clear
Caching my config > php artisan config:cache
None of these had any successful results so far.
What could cause this weird bug and is there a way to fix this?
Any help or information regarding this is well-received.
You can add code
ini_set("soap.wsdl_cache_enabled", 0);
or manualy remove all wsdl* files in your /tmp folder on the server.
WSDL files are cached in your default location for all cache files defined in php.ini. Same location as your session files.
In PHP how can you clear a WSDL cache?

Deploying Laravel 5.4 to Shared Hosting

I've got a real head-scratcher for you! I've been working on a Laravel 5.4 application for quite some time now and up until yesterday I had been able to:
develop on my local machine [still works flawlessly],
push my changes to my BitBucket repo [still okay here],
and would subsequently pull those changes to my shared hosting server (RedHat) [still running smoothly],
I then run my dependency managers (npm and composer) to get the project in place and functional
there is some matter with clearing various caches:
php artisan view:clear
php artisan route:clear
php artisan cache:clear
composer dump-autoload
and finally move my '/public' folder to the web root and update index.php to point back to the 'bootstrap/autoload.php' in main project structure,
I am aware there is likely another or several steps I am missing, but I am unsure what they are...
All that being said, I've attempted to deploy a number of applications using Laravel lately and I always seem to run into the same issue come time to deploy an application to production. I've read 30+ tutorials on the matter and nothing seems to explain the issue why my site isn't working any more.
I've checked the error log file maintained by Apache, it's empty.
Was wondering if it's a permissions issue, doesn't seem to be the case (all folders set to 775 and files set to 664 as specified by various sources and owned by serverName:userName)
Browser console simply shows a 500 server error.
All I see if "Whoops, looks like something went wrong." twice.
There must be some way to show better error details (config debug setting already set to true)
Any suggestions at this point would be beneficial to send me looking in the right direction!
======= UPDATES =======
For the sake of thoroughness, and that this save others from severe headaches, I'll be posting actions taken here.
Following tutorial mentioned by #user123456 (permissions applies)
Generate new key for application
Run php artisan config:clear
Off to the races, answer to come!
You need to ensure you have a working .env file.
Once done, run php artisan key:generate to create a key for your application after which you should clear your application's cache as follows php artisan config:clear
I would never recommend using shared hosting for Laravel application. You will face lots of issues for permissions, composer and external dependencies. Instead, you can use cloud servers like DigitalOcean, Linode, vultr and deploy laravel application on them. If you don't know about linux and creating Stacks you can use Cloudways to deploy laravel.
https://dev.to/rizwan_saquib/deploy-laravel-application-on-cloud-easily-with-cloudways

Laravel env file is not loading

I have moved my laravel project from local to production server which is centos vps.
Strange thing I'm facing is laravel can't read from .env file, And I have tested everything to make it work but no success.
I have set it's permission to 777 and it's owner to the owner of vps.
still no success.
FYI : it is in gitignore but I have created .env file on server so this problem has nothing to do with gitignore.
Can someone walk me through step by step running laravel on production server?
Exactly what should be done and what commands do I need to execute, where should I put project and where should put public directory files ?
please help me out.
Maybe you could try to clear config cache:
php artisan config:clear
In production environments you should never have a .env file. Instead, create the appropriate environment variables and PHP will read them from there.
Taken from the official DotEnv docs:
phpdotenv is made for development environments, and generally should
not be used in production. In production, the actual environment
variables should be set so that there is no overhead of loading the
.env file on each request. This can be achieved via an automated
deployment process with tools like Vagrant, chef, or Puppet, or can be
set manually with cloud hosts like Pagodabox and Heroku.
Have you tried this-
Copied from the official Documentation
After installing Laravel, you may need to configure some permissions. Directories within the storage and the bootstrap/cache directories should be writable by your web server or Laravel will not run. If you are using the Homestead virtual machine, these permissions should already be set.

Laravel's caching configuration

I have deployed a website made with Laravel to my server. I have changed all the configurations but when I run it on browser, it gives me PDO error.
I figured out that Laravel configuration has not been changed even though I have.
It was certain that laravel was caching my old db configurations, so
I tried
php artisan:cache clear
But it didn't work.
Anyone has a solution?
php artisan config:clear for Remove the configuration cache file

Why are my custom laravel artisan commands not available in production environment

I have just installed a laravel app on the "to-be" production server (1and1 shared linux server).
With the same codebase as on my development server (Ubuntu 14.04 lts) my custom artisan commands are not available (php5.5 artisan list) on the production server.
I have done composer dump-autoload already.
I have also checked the app/start/artisan.php file and that is OK and is executed.
I have checked the app/config/production/app.php for the service providers and they seem to be all right.
I have also spent the better part of the day here on stackoverflow to find a solution, but without much success.
My Laravel version is: 4.1.28
Thanks so much for any help.
If you are getting no errors, you probably don't have the same codebase in production because, if resolve commands in your artisan.php file:
Artisan::resolve('CommandName');
And Laravel doesn't have access to this class, it will raise an exception:
"ReflectionException","message":"Class CommandName does not exist"

Categories