Symfony 6 project size - php

So I started learning symfony 6 a few days ago, the problem is that my projects are way too big, and I don't know if that's normal. I created a site with a single home page, and the project is still 120 MB, so my question is, is it normal or is it me, I'm doing it wrong?
To publish my project I put all the files on the server with ssh, except the vendor file and .gitignor , then on a terminal of the server I used the command: "Composer install" to install all the dependencies, and the I was surprised to see that the storage taken by my site is 120mb, I can't imagine if I had put images and lots of pages.

Related

Dockerize existing Laravel vs creating new projects + copy files

I am struggling with new Dockervel environment on Monterey. Before going further, I would like to have some general advice.
Before Monterey (on Mojave), I use HomeBrew and Composer to create Laravel projects and adding dependencies. I have 10 existing projects like that.
After doing a clean install of Monterey, I decided to go for Docker. I successfully created a new project and also installed phpMyAdmin (into 2 containers mysql & phpmyadmin).
Now I need to move these 10 "old" Laravel projects from my backup to Docker on Monterey.
So I moved the first old project and dockerized it but ran into version issues which I assume I might be able to fix (I have another post specifically on these issues).
Is it the best way to do this to upgrade the 10 old projects to Docker? I presume that at the end I will have 10 containers (one for each project) plus the 2 php/phpMyAdmin. Will I be able to have several docker containers running at the same time and be able to view them in the browser as localhost/project1, localhost/project2... and so on?
I also tried to install a new project and copy all the specific files into it from the backup but that is very cumbersome. Is that an option?
Is there another easier solution?

How to get running on a local dev environment from an existing and complex Magento2 project

At work we took back our existing store running on Magento 2 from an external development agency. I need to get the project running in local development (with docker).
I familiarized myself with a vanilla project from the official docs and managed to get it running by downloading the vanilla template with composer, granting the proper permissions on files and folder and running the magento setup:install command.
My question is how do one goes when kick starting from an existing (production running) project?
Do I need to run setup:install again? If I do, why?
What do I need to import from production to ensure any content or configuration created via the admin is also running on my local setup? Should I import the complete Database from production?
I know our setup is using more than just php and mysql, but env.php seems to be listing only db configuration and admin url. Where can I get the complete service configuration informations about what our setup uses?
Anything else I am missing to get started with an existing project for local development?
As someone who is running Magento 2 on a local environment myself, hopefully I can shed some light on this.
If you have a direct copy of the live site, you do not need to run setup:install again.
Ensure you have a copy of the entire Magento 2 site (you can technically ignore the vendor folder, as you can run composer install and it will redownload those files, but that's up to you). Also get a copy of the entire database. Magento 2 is notorious for copying the same data to multiple tables so something could break if you don't have everything.
What do you mean by "service configurations" If you are referring to Magento 2 extensions, that data is saved in the database, not the env.php file. env.php is only for server side configurations, such as the DB information, Caching, and things of that nature. On mine, I use Redis for site Cache, so that would be included in that file as well, as an example.
When you first unpack the site to your local environment, run composer update in the directory. This will ensure you have all the proper files installed. If you are going to run a local dev environment, set the mode to development with the following command: bin/magento deploy:mode:set developer. This will allow you to make changes and to view those changes by just refreshing the page, rather than flushing cache all the time.
All queries are replied correctly by Eric. I am also not sure about "service configurations" you have mentioned here. If this is about third-party extensions/services you can check config.php file for this.

Laravel app downloading all assets again on every route request

I have a strange error in my Laravel(5.6)/app. Whenever there is any route request in the app, all css, js, bootstrap and icons files reload all over again in the browser. I'm debugging this app from last 2 days. And I have no clue what's going on.
I worked on this project a few days ago and it was working fine then I started working on some other project and after a couple of days when I worked again on this project to add some new features, it is behaving like this. Whenever I request any route in the app, all the assets download and load again in the browser. I didn't provide any code sample here because I don't know where the error might be.
If there have been an error in some particular file then that particular route would have behave that way. But all routes reload all the assets all over again. So I just want your opinion is this ever happens to you and how should I tackle it?
If you wanna recreate this project then here is the GitHub link. Git Repo . Recreating this project is very easy. Just create a database. run migrations and then seed the database. For sass and js ,run 'npm run dev' if needed.
Update: Solution to this problem is, don't use buit-in server of laravel, it sucks. Use any php development stack like xampp, wamp etc. and it will work fine.

Deploy Simple Symfony application to Azure : Slow?

Last week, I tried to deploy a simple symfony app on azure.
I choose the plan app service B2 (2cores / 3.5Go RAM).
PHP Version : 5.6.
First it took forever to complete the composer install. (I tried to go on S3, it was a little faster but not very different).
So I tried to optimize the php config, opcache, realpath_cache_size...etc (xdebug already disabled).
I even tried to enable wincache, but with no real improvment.
So now my app is deployed, but it is too slow to be usable.
A simple php app/console (in dev mode) takes ~23secondes.
It seems to recreate the cache everytime. On my local unix environnment (similar specs), it takes 6seconds when the cache is cold and 500ms when the dev cache is warm.
I think that the main problem is a filesystem issue, because to remove the dev cache folder it takes 16 seconds.
On my local unix environnment, similar specs, it takes ~200ms to remove the same folder.
Like I said I tried S3 Plan with a small improvment but not enough to explain this slowness.
One thing weird, it's that if I rerun the command php app/console just after it finished, the command takes 5seconds to run (much better). But If rerun it 5seconds after it finished, it takes 23seconds.
I already tried these solutions (even if the environnment is different) :
https://stackoverflow.com/a/17021255/6309878
Update : I tried to set the symfony app/cache folder to the local filesystem D:\local\cache, but no improvment, it may be worst.
Please try below steps and let me know if it improves the performance -
1) In the wwwroot directory of your site, create a .user.ini file (if it doesn’t already exist) and add “wincache.fcenabled=0”. This will disable Wincache.
2) Go to Azure Portal and go to the Application Settings for your app. In the App Settings section, add “WEBSITES_DYNAMIC_CACHE” with a value of 1.
3) Restart the site.

Laravel 5 splash screen returns row of question marks

I've been looking for an answer to this issue for a day or so now since I'm sure the solution is trivial but I can't seem to find it.
On a fresh install of Laravel 5 through composer create-project I get a splash screen that looks like this:
It's very faint but there is a line of question marks running along the top of the page.
I'm running Windows 8.1 with WAMP 2.5.
Some searching threw up some answers regarding the addition of detect_unicode = off in my php.ini file but this hasn't solved it (and I've ensured I'm editing the correct php.ini file what with there being several using WAMP).
Composer was installed using the Windows .exe file and oddly enough, I have other Laravel 5 projects running on the same machine without any issue. As a test I push the site exactly as it is to the live server (a unix machine) where it displays correctly.
Laravel itself doesn't report any errors.
Other possible answers seem to point to a BOM in the files. I'm using PHP Storm for most of my editing but I'm unsure of how to remove any BOMs in the files.
Thanks.
It could be because your precompiled files may have been corrupted somehow along the way.
Try deleting the file compiled.php inside the /vendor/ folder and run composer update from the command line right after.

Categories