This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
hints [2014/01/29 18:04] 127.0.0.1 external edit |
hints [2016/03/27 17:11] (current) |
||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ====== Hints ====== | ||
+ | ===== PHP Includes | ||
+ | |||
+ | Some people include files like | ||
+ | |||
+ | include(' | ||
+ | |||
+ | or | ||
+ | |||
+ | virtual('/ | ||
+ | |||
+ | or | ||
+ | |||
+ | readfile(' | ||
+ | |||
+ | |||
+ | moreover they use it may times per page. | ||
+ | |||
+ | You should NOT use it. | ||
+ | |||
+ | **Why:** | ||
+ | |||
+ | PHP creates page BEFORE user gets it. So if you have something like include(' | ||
+ | |||
+ | There 2 downsides of this approach: | ||
+ | |||
+ | * PHP create a regular connection to that host requesting a page. If you have 10 such includes - 1 request to such page generates 10 subrequests loading server. | ||
+ | * If for some reason PHP won't be able to connect to that domain and load that page - it will wait and first page won't be loaded until PHP gets that include. So if that otherdomain is down - first domain will be virtually down too. | ||
+ | |||
+ | |||
+ | **What to do:** | ||
+ | |||
+ | Use only local includes. | ||
+ | Ie virtual('/ | ||
+ | |||
+ | if file is located at another server - ask admin to setup rsync or copy file using crontab and so on. | ||
+ | |||
+ | |||
+ | **Including local script with parameters** | ||
+ | |||
+ | Let's say you have include like | ||
+ | |||
+ | < | ||
+ | <?php | ||
+ | include(' | ||
+ | ?> | ||
+ | </ | ||
+ | |||
+ | |||
+ | so you have some parameters here. You can pass it as | ||
+ | |||
+ | < | ||
+ | <?php | ||
+ | $_GET[' | ||
+ | $_GET[' | ||
+ | include(' | ||
+ | ?> | ||
+ | </ | ||
+ | |||
+ | |||
+ | ===== Close site for some countries ===== | ||
+ | |||
+ | Example for .htaccess | ||
+ | |||
+ | < | ||
+ | RewriteEngine on | ||
+ | RewriteCond %{ENV: | ||
+ | RewriteRule ^$ http:// | ||
+ | </ | ||
+ | |||
+ | |||
+ | ===== Count productivity from feeders ===== | ||
+ | |||
+ | There' | ||
+ | |||
+ | The easiest way is to switch on the option "add notrade as feed traders" |