Difference between symfony server and bin/console server? - symfony

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.

Related

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.

Symfony 2.7 - Changes to Views in shared hosting not working

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.

Multiple configuration Symfony2

I'm using Symfony2 as framework to develop my application, but i currently use svn, and i need to setup 2 configurations on my project,
The first configuration will be work with my server Mamp.
The second one, will be for my development environment server.
How to do this ?
Thanks all

Is it possible to run symfony2 development server with ssl connection?

I am developing my new project in symfony 2 in built-in Symfony2 sever (app/console server:run). Is it possible to run my website with https on this server?
now it is possible using the symfony cli, you can install a ssl certificate
symfony server:ca:install
https://symfony.com/blog/local-web-server-reloaded-for-symfony-apps
To install symfony client if you are on a Mac run:
curl -sS https://get.symfony.com/cli/installer | bash
Otherwise check this link for other OS: https://symfony.com/download
The php app/console server:run use the PHP built-in web server that was designed to aid application development and isn't supposed to support SSL, just plain HTTP requests.
You can try to use this https://stackoverflow.com/a/12946566/3059764

Deploy Spring MVC in WSO2 Application Server

I am trying to deploy my Spring MVC application on WSO2 Application Server by going to Main > Manage > Applications > Add > Web Applications and upload my Spring MVC's WAR file. The upload completed successfully, but I still can't run the web app itself. The error message just basically complaining it doesn't have org.springframework.
The same WAR file can be run on Apache Tomcat with no problem at all. All I did is dropping the same WAR file to \webapps, and it works.
Is there a special setting that needs to be configured to get Spring MVC run on WSO2 Application Server? I would assume WSO2 Application is also using Apache Tomcat, so why it won't run by just uploading the WAR file?
Thanks!
What is your WSO2 AS version ? please make sure to use latest AS 5.1.0 version. We have tested large number of Spring (including SpringMVC) based applications on AS 5.1.0, basically if something working on Tomcat it should be work on WSO2 AS too. If you still have issues on AS 5.1.0 please let me know.
I solved this issue by:
Upgrading WSO2 AS to latest version (5.1.0) as mentioned by Sagara Gunathunga. For some reasons, previous WSO2 AS doesn't take my JSTL templating (something like $ {blabla}). Only in 5.1.0 did the issue resolved. I start to wonder what this WSO2 is doing with its half-baked product.
Modify Maven POM file, specifically slf4j-api dependency. WSO2 has its own slf4j-api library and I have to set the scope of slf4j-api in my app to "provided" before deploying to WSO2. This solve the issue with unable to load all JavaScript files.
Downside for this is you will need the scope of slf4j-api to be "compiled" when you run this locally under regular Tomcat. Setting it to "provided" will not work under Tomcat. But in WSO2, the scope will need to be "provided" to run. So, there is manual work to change before deploying the application.
I did try to match the slf4j-api version to match what WSO2 and set the scope to "compile", but it still won't work. WSO2, for some bad reasons, can't use my app's compiled slf4j-api.
yes there is a separate workaround to deploy a spring service to wso2 appserver. Please follow [1] for instructions.
[1]. http://docs.wso2.org/wiki/display/AS510/Spring+Services
Thank you,
Dharshana
#stack247,
Well I'm from WSO2 and it's nice to hear that your JSTL issue is solved by now. But I completely disagree with " I start to wonder what this WSO2 is doing with its half-baked product" statement. You may know that spec like Servelt , JSP and JSTL having different versions and update it's version with time. Previous version of application server does not supported for latest JSP 2.0 and JSTL 1.2 specs hence you can't use application which depends on JSP 2.0 or JSTL 1.2 that was a known limitation but can't consider it as half-baked product due to that. This is very common nature with any software product and that's why we are actively developing, fixing issues, upgrading dependencies and frequently releasing new versions, also we are responding to community issues like this.
With Latest AS 5.1.0 release we officially support for Servelt 3.0, JSP 2.0 and JSTL 1.2 and any dependent applications too. When it come to logging case most of the application server having their own logging mechanisms and some cases it's required remove logging dependencies from applications.

Resources