Inter-Server Utilisation With PHP
PHP is a very powerful tool for any webmaster, allowing them to create bespoke web tools to aid with day to day tasks such as managing link partners, mailing lists, seo and much more. Cross site scripting or inter-site scripting is a technique used to spread the resource usage a script has over multiple servers. The terminology is not to be confused with XSS, a security vulnerability that is found in web applications where attackers can add harmful scripts to the website. The idea is to give webmasters the ability to run powerful and resource intensive scripts without being banned by their web hosting provider.
Despite most web-hosts only allowing a maximum script execution time of 30 seconds, which is the default setting found in php.ini, it can be extended in scripts that use the maximum execution time function (set_time_limit()) and set it to a different value. As an example, maximum execution time could be reset to 10 seconds each time a loop completes. If the loop continues forever, then the script will never cease executing. This is what can get your hosting account banned as virtually all hosting companies will state that excess use of server resources is a breach of their terms and conditions.
Depending on the complexity of a script, made in either PHP or ASP, the server resource usage can be very high indeed. To minimise usage and attempt to avoid detection by the web-host, developers can insert a number of sleep(x) statements (where x is the number of seconds to wait for) to make the script go easier on the server. The problem is that although this solution works most of the time, it really isn’t practical for mission critical applications because those sleep statements add up resulting in a lot of wasted time.
Of course, the ultimate solution is to set-up your own server specifically for the purpose of running your own scripts without the restrictions imposed by the majority of web-hosts. This isn’t an option for non-server savvy webmasters who don’t have the time to learn how to set-up and manage their own server. So the next option is to spread the resource consumption your script uses over multiple servers, from different providers. Most established webmasters may well have more than one website, so this is a practical option that is much easier to do than creating your own server at home. It is especially easy to implement if the developer has made their PHP script object orientated rather than procedural, but either will work well across multiple servers to get the tasks done. For instance, if we have a script that checks to see whether our link partners are still linking to our website, two or three servers could be home to a script that is just used to do the checking and MySQL interactions to retrieve and process the data on link partner urls, and another server could house another script that sends out automated emails reminding partners to fix or correct their link to us.
One of the main function sets to use for this kind of cross site scripting is Curl. Curl is a library of functions that can be used to build these connections between scripts on different servers. The “master” script can build the tasks that need to be done and post them to the “slave” scripts on the other servers. Those slave scripts then post the completed results back to the master script. Results will often be contained in a variable which looks something like “$MyVar”. Curl was specifically developed to allow efficient and powerful interactions across urls. Most web hosts support Curl as it is a part of any modern release of PHP. If you web-host doesn’t have it enabled, then cross site scripting will not work.
Don’t let your enthusiasm for coding get your website banned!
webtools
#InterServer #Utilisation #PHP
Will be pleased to have you visit my pages on social networking .
Facebook page here.
Twitter account is here.
Linkedin account here
Post byBedewy for info askme VISIT GAHZLY