Symfony2 problems with cache - php

I have worked with one project on Symfony2. It works on my local server, but when I uploaded this project to the hosting, it has stopped working. Over time I have found, that problem is with the cache directory.
So uploading the cache from the local server to the hosting has solved this problem.
What can the problem be? What are the main problems with cache on Symfony2?

You don't upload the cache folder. These are only temporary files. Look at the docs about how to deploy.
Most likely you have to run:
php app/console cache:clear --env=prod --no-debug
Also check that the cache and log folder is writable as pointed out on the installation documentation:

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?

Lumen Artisan Issue: No memcached servers added

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.

Fresh Laravel install deletes server.php on artisan serve

I'm a bit fresh to Laravel. I installed it via composer in the xampp/htdocs file. I installed the latest version 5.6.
The install works with no errors, and the file structure is as it should be.
When I run the php artisan serve command from inside the folder, it deletes the server.php file and therefore outputs the error:
This site can’t be reached.
localhost refused to connect.
So I thought why not just add a new file inside and it will work... Well, trying to add new file shows that I do not have permissions to add files to this folder.
I tried a new install a few times, but the situation is always the same.
Has anybody else encountered this problem?
So I realised it was some kind of server problem... well, removed the antivirus, chanhed my firewall settings and everithing works as it should.
My advice to avoid this in the future is to start creating Laravel applications in a folder inside of your My Documents folder in Windows or using /home/{your-username}/projects directory in Unix environments.
What likely happened is xampp has certain permissions that don't play nice with what you need in Laravel.

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.

How to move a Symfony project from web hosting to localhost?

I tried some solutions (ex: Transfer Symfony2 site onto localhost from web server), but never works, the result is always a blank page.
The project is on Symfony 2.3 and my php version is 5.5
Thanks
When accessing a Symfony2 site locally you need reference one of the routing files in the web folder directly. So try http://localhost/app_dev.php/ and it might give you an error message telling you what is going wrong. Also you can check the log files in the /app/logs folder to see what the problem might be.
Edit:
There are also several command line tools that might be needed to set up the project.
app/console doctrine:schema:update --force
This will check the database is in sync with your code and update the database if necessary.
app/console assetic:dump
app/console assets:install
app/console cache:clear
These are used to install css, javascript and other static assets as well as clearing the cache.

Categories