Symfony 2.7 - Changes to Views in shared hosting not working - symfony

I'm working on a website developed on Symfony 2.7 and hosted on a shared host. It seems like views are served from Symfony cache created with assetic library. These cache files are not re-generated automatically after making changes to views. How do I apply changes in such scenario?

After doing some changes, you should clear the cache by running this command:
php bin/console cache:clear --env=prod

I had the same issue with a shared hosting. I had to connect to the server (ssh/ftp) and manually delete the cache folder generated for twig.
This cache folder in production mode and for that Symfony version is located at app/cache/prod/twig.
I hope it helps.

Related

Symfony 2.5 deployment and cahce issues

I'm working on an old Symfony 2.5 application. I don't have SSH access on the server, I can't do the cache:clear command or any other Symfony command. I don't have access to the git repository either. I'm working with a manual backup made from the production server.
I made some changes to the Twig template, the changes are shown in DEV but in Production, the changes do not appears.
If I manually delete the /cache/prod/twig folder from the server, will it clear the cache and can it break the site.
There is also a 'deploy' file, which is a shell script, but I don't know which deployment platform has been used in the past with this file. Does someone know about this file.
Thanks

Silverstripe - Fresh installation no install page

I installed Silverstripe via Composer, just as described in the Silverstripe lessons.
It worked fine and the page is accessible by localhost.
I'm using XAMPP (newest version) with Apache and MySQL running.
Plugin php-intl is also enabled.
However, when I try to access the site it shows me the following message:
SilverStripe Framework requires database configuration defined via .env
I should see an install page, but there's just this message.
It is a completely fresh Silverstripe project. No changes have been made.
What can I do to fix this problem?
As described in the Silverstripe getting started guide we need to create a .env file and set it up with our environment variables.
W create a .env in our project root (not the public/ folder). In this file we set up the minimum required environment variables. Replace the placeholders as required:
SS_DATABASE_CLASS="MySQLDatabase"
SS_DATABASE_NAME="<database>"
SS_DATABASE_SERVER="localhost"
SS_DATABASE_USERNAME="<user>"
SS_DATABASE_PASSWORD="<password>"
SS_DEFAULT_ADMIN_USERNAME="admin"
SS_DEFAULT_ADMIN_PASSWORD="password"
SS_ENVIRONMENT_TYPE="dev"
Now we should be able to build our database by visiting http://<local-website-url>/dev/build.
Our website should be available on our local domain now.
Note, Silverstripe previously was packaged with an installer UI. This was removed from the core framework in version 4.5 and moved into it's own separate silverstripe-installer-wizard module. This can be added to the project by running composer require silverstripe/installer-wizard.

Difference between symfony server and bin/console server?

I want to use the Symfony web server for local development, but I'm surprised that Symfony actually comes with two servers:
the Symfony local web server - started with symfony server:start
the Web Server Bundle - started with bin/console server:start
I find it very confusing to have these 2 options, as the docs do not seem to give you any hint as to why you should use one over the other and under which circumstances.
As far as I can see, it looks like the Web Server Bundle (bin/console server:start):
is just a wrapper around PHP's built-in web server
is installed using Composer
while the Symfony local web server (symfony server:start):
is a full-fledged web server
must be installed as standalone (as part of the symfony command)
Still, I can hardly understand why they do release these 2 options. At first glance it looks like the Symfony local web server is more powerful; in this case why would they release the webserver bundle as well?
As mentioned in the Web Server Bundle docs:
Deprecated since version 4.4: This article explains how to use the WebServerBundle to run Symfony applications on your local computer. However, that bundle is deprecated since Symfony 4.4 and will be removed in Symfony 5.0.
Instead of using WebServerBundle, the preferred way to run your Symfony applications locally is to use the Symfony Local Web Server.
So the recommended way is to use symfony server:start to serve an app in development.
Thanks to #Cerad and #Jakub Matczak for their comments.

Prestashop 1.7 local environment and symfony server:run command

Prestashop 1.7+ is based on Symfony.
Symfony local environment debug mode means, that you runs command "php app/console (or bin/console at Symfony v3+) server:run" to start local webserver emulation and to view your project with local browser at localhost address (e.g. 127.0.0.1) without any WAMP, MAMP, XAMPP etc.
Also, local debug mode means, that you use app_dev.php prefix to view site in debug mode (with error and performance reports, profilers and other cool symfony features)
There is also commands in Symfony like "php app/console (or bin/console at Symfony v3+) doctrine:schema:validate)", to validate if Doctrine entities model correlate with Mysql database.
So my questions are:
Is Prestashop 1.7+ support "php app/console (or bin/console at Symfony v3+) server:run"?
Is Prestashop 1.7+ support Symfony app_dev.php debug mode?
Should I use "php app/console (or bin/console at Symfony v3+) doctrine:schema:validate)" to ensure that model and database are correct?
Are there any plans to use Twig instead of Smarty?
Thanks.
Prestashop 1.7 only uses very few symfony components mainly for the backoffice product listing and the modules page.
You cannot use any of the symfony commands as the app/console is not included.
Also even though going through the source files you will find doctrine the doctrine entities are not used anywhere so you cannot validate the schema.
Twig is only used in the backoffice on the 2 pages I mentioned earlier.
All in all you won't really stumble upon any symfony unless you go into the core code and you cannot (easily) include any bundles or use any Symfony commands.

Migrating Symfony Project from Windows to Server in Linux

Once my web application is running on local, I want to pour it into a server. Whenever I upload it, I'm having problems with the routing staff.
I guess it is searching on local routes (in full paths) instead of server ones.
So this is the error given:
Warning:
file_get_contents(C:\xampp\htdocs\MyApp\src\MyBundle/Resources/views/Default/index.html.twig):
failed to open stream: No such file or directory
Obviously, it is mixing Windows routing(computer) with Linux paths (server).
I have been looking for the config files or whatever, searching in the routing files but nothing changed.
*Edit: I am currently using 2,8 version of Symfony
First, you should make sure you’re not uploading the app/cache directory, or that you’re clearing the cache after uploading.

Resources