Windows 7 php + symfony2 terribly slow

This is a problem that I have been facing for a long time. I want to run PHP applications on my Windows computer, and it has an awful boot time, about 10-25 seconds. I have tried many things:

  • At first I tried a simple installation of XAMPP.
  • I read that WAMP can be faster, so I also tried WAMP. It gave me the same results.
  • Then I installed a nginx server with PHP, but that didn't help
  • Finally, I installed Ubuntu 11.10 in VirtualBox, and I shared the Windows files containing my project, but the result was even worse: more than 22 seconds of boot each time.

UPDATE : I even tried APC - it improved a bit, but still 6-8 seconds / page

I uploaded my files to the linux server (shared hosting), on which it runs for about 300-500 ms. On the XAMPP installation, I also tried to run other (that is, not Symfony2) applications (for example, phpmyadmin), which were also slower than shared hosting, but not very slow, with a load of 2-3 seconds. Until I switch to Linux as the main OS, how could I improve performance? I have a laptop with an i7 processor, 4 GB of RAM, 5400RPM HDD, Win7 x64.

Thank you for your help!

UPDATE2: For some mysterious reason, my Symfony routing did not work with fcgid (this gave me a 404 error for everything), so I returned to use PHP as a module. Now it has become the worst ever (worse than before): the application mode is 20-25 seconds, and in dev mode - more than 30 seconds each time, so I get a timeout error, and this is the same with without using APC.

You can see this error here. This is reproduced: every time it reaches another point of execution within 30 seconds:

enter image description here

+34
performance php windows-7 apache2 page-load-time
Mar 24 '12 at 19:34
source share
10 answers

I had a similar problem with symfony 1 for a while on XP and Server 2003. The solution was to install the PHP accelerator (for us, it’s better to use APC at present, and FastCGI / fcgid is a better APC bid).

Addendum: It has been a long time since I used Apache for Windows. As a rule, I was of the opinion that his work is steadily improving, and not worse; however, as is the case with the most unusual settings, YMMV. According to my previous comment, I recommend asking your question in the Apache Lounge , where I previously received excellent expert advice.

If the memory is working correctly, they can offer you a free Apache binary compiled with better tools than the standard one offered on the Apache website.

+8
Mar 24 '12 at 19:38
source share

Update:

Since PHP 5.5 has now integrated PHP OPCache, this speeds up execution time. In my setup, a full query with access to the database takes 180 ms.

Steps:

  • Update to latest php version
  • Enable OPCache
  • Disable xdebug
  • Set truepath_cache_size = 2M as specified in DemonTPx

php.ini :

realpath_cache_size = 2M [XDebug] xdebug.profiler_enable = 0 xdebug.remote_enable = 0 [opcache] zend_extension = "C:\xampp18\php\ext\php_opcache.dll" opcache.enable = 1 opcache.enable_cli = 0 opcache.memory_consumption = 128 opcache.interned_strings_buffer = 8 opcache.max_accelerated_files = 4000 

Why is Windows slower than Unix?

As discussed here , PHP is very slow in exists_files and filemtime () on Windows. since Symfony2 uses these features a lot in dev mode. we will not get up to 700 ms (at <= 5.4) on Windows. PHP 5.5 now allows 180 ms.

The solution could be WinCache , which was developed by Microsoft to solve this problem in IIS. But since it only works on several versions of Windows, and also only on IIS, this is not a solution for me.

Alternative

Also a good solution that I can recommend is to have a Linux virtual machine on Virtualbox. This is easy to set up, and also more like a production environment.

+24
Jun 10 '13 at 10:00
source share

I have the same problem. Installing the following in php.ini increased performance for me from ~ 800 ms to ~ 300 ms:

php.ini:

 realpath_cache_size = 2M 

Still not ~ 100 ms I get from a unix machine, but that matters at least

+19
Jul 23 '13 at 17:55
source share

Wow, having tried many different things, I finally managed to switch from a 15 second runtime to 3s runtime on windows7 using wamp.

How to install the wincache extension: http://us2.php.net/manual/en/wincache.installation.php

Where to download wincache dll: http://sourceforge.net/projects/wincache/

Changing php.ini configuration:

 [PHP] realpath_cache_size = 2M extension=php_wincache.dll ; XDEBUG Extension ;zend_extension = "C:/Net Generation/wamp/bin/php/php5.5.12/zend_ext/php_xdebug-2.2.5-5.5-vc11.dll" ; [xdebug] xdebug.remote_enable = off xdebug.profiler_enable = Off xdebug.profiler_enable_trigger = off xdebug.profiler_output_name = cachegrind.out.%t.%p xdebug.profiler_output_dir = "C:/Net Generation/wamp/tmp" xdebug.show_local_vars=0 xdebug.max_nesting_level=200 [opcache] zend_extension = "C:/Net Generation/wamp/bin/php/php5.5.12/ext/php_opcache.dll" opcache.enable = 1 opcache.enable_cli = 0 opcache.memory_consumption = 128 opcache.interned_strings_buffer = 8 opcache.max_accelerated_files = 4000 
+3
Jan 27 '15 at 14:20
source share

I think you have problems with the caching mechanism. check the application directory \ cache. there must be a folder called dev. if it does not exist or it is empty, check the permissions of the folder. when I delete the dev and prod files in the app \ cache directory, it takes 18 seconds to load the page, but after that it only takes 500 ms.

+1
Apr 3 2018-12-12T00: 00Z
source share

A few years ago I had the same problem. What antivirus software do you use in the background? Try deactivating it for dev purposes or changing it. There may also be some indexing services running in the background. Symfony 2 consists of> 15,000 files with sellers :) Also try to do this in a classic way by reinstalling Windows from scratch. My sites usually take from 100 to 500 ms, and my laptop is slower than yours. (Intel C2D P8600)

+1
Apr 09 2018-12-12T00:
source share

Just a hunch (and probably not the right one), but it could be due to MySQL. Seeing that you mentioned PhpMyAdmin and Symfony 2 as the PHP applications you tested, both rely on MySQL (assuming MySQL is configured in Symfony 2). You did not mention this in your post, but in the VirtualBox setup did you accidentally allow a script running on Ubuntu to connect to a MySQL server on a Windows host machine?

You can check PHP Benchmark for some performance testing scenarios and see if these scripts work over time.

One more thing you could try: Xdebug and see if you find (a) certain (group of) that take too much time.

I will definitely keep this question as a favorite, because I'm too curious to see what it was now :) good luck!

+1
Jul 27 '12 at 14:29
source share

Check your computer’s RAM, RAM using http://oca.microsoft.com/en/windiag.asp or run the memory testing application that comes with your Ubuntu download.

In both cases, choose what is known as an additional or deep test - I don’t remember exactly - however, choose a test with a longer time, this type of test has no end, you just wait until the test ends in two phases and Any problems with your RAM are usually shown.

In addition, check your hard drive with any means of verification. after that try to defragment the disk

I am a little, your problem is hardware.

0
Jul 28 '12 at 11:32
source share

My pages took 20 seconds. I installed fast cgi, increased memory limits, everything does not work. Then he began to look at the graph and noticed that the Symfony firewall module took up most of the time. It turns out that having “localhost” in my configuration for the doctrine was what caused the problems. Changing this parameter to 127.0.0.1 fixed the problem. I don’t know why, but it is described here:

http://12wiki.blogspot.ca/2012/11/why-does-symfony-2-firewall-take-so.html

0
May 17 '15 at
source share

Page load time also depends on CSS + JS + load time. I had the same problem in CakePHP and solved the problem using mod_expires in htaccess.

Have you tried "ExpiresByType" in your server's htaccess file for CSS, JS and images? Check out this page .

-one
Jul 24 2018-12-12T00:
source share



All Articles