PHP and wampserver loading data on users computer using virtual host is too slow

て烟熏妆下的殇ゞ 提交于 2019-12-11 15:49:54

问题


I have a PHP-MySQL based single page application (using Angular 6), working on a local network.

We set up the etc/hosts as following:

#127.0.0.1 localhost
#::1 localhost

192.168.0.217   dev.local
::1 dev.local

#127.0.0.1  angular.local
#::1    angular.local

127.0.0.1 localhost
::1 localhost

192.168.0.217   angular.local
::1 angular.local

the angular.local is the application to open on users windows and dev.local to access the PHP script for login, adding, editing,...

The httpd-vhosts is as the following:

# Virtual Hosts
#
<VirtualHost *:80>
  ServerName localhost
  ServerAlias localhost
  DocumentRoot "${INSTALL_DIR}/www"
  <Directory "${INSTALL_DIR}/www/">
    Options +Indexes +Includes +FollowSymLinks +MultiViews
    AllowOverride All
    #Require local
    Allow from 192.168.10.0
    Allow from 192.168.0.217
Require all granted
  </Directory>
</VirtualHost>


#dev.local
<VirtualHost *:80>

    ServerAdmin it@m.org
    DocumentRoot "c:/wamp64/www/dev"
    ServerName dev.local    
    ServerAlias www.dev.local

    <Directory  "c:/wamp64/www/dev/">   
        AllowOverride All
        Require ip 192.168.0
        Require ip 192.168.1    
        Require ip 192.168.10
        Require all granted     
                Allow from all
    </Directory>
</VirtualHost>


#
<VirtualHost *:80>
    ServerName angular.local
    DocumentRoot "c:/wamp64/www/angular/"
    ServerAlias angular.local
    <Directory  "c:/wamp64/www/angular/">
        #Options +Indexes +Includes +FollowSymLinks +MultiViews
        AllowOverride All
        Require ip 192.168
        Require all granted
        Allow from all
    </Directory>
</VirtualHost>

On server side, when running the application, getting about 11000+ records took 1.11 seconds:

On a user computer, where we allowed to him to access the application by changing his etc/hosts file to:

#127.0.0.1  host1
#::1    host1
#127.0.0.1 aff.local
#127.0.0.1 primero.test
#127.0.0.1 localhost
#::1 localhost
127.0.0.1 dev.local

192.168.0.217   angular.local
192.168.0.217 dev.local
::1 angular.local

The request to get the 11000+ records took 13.25 seconds which is a very bad timing:

I did everything written in this answer but still having the same problem, and on some computers it took 25 seconds.

As said in this link, I changed all the AllowOverride All to AllowOverride None.

The documentation said:

Then Apache will attempt to open /.htaccess, /www/.htaccess, and /www/htdocs/.htaccess. The solutions are similar to the previous case of Options FollowSymLinks. For highest performance use AllowOverride None everywhere in your filesystem.

But still having the same issue.

Then I checked this link and disabled xdebug but still having the same issue.

来源:https://stackoverflow.com/questions/53153459/php-and-wampserver-loading-data-on-users-computer-using-virtual-host-is-too-slow

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!