PDF Google Drive Downloader v1.1


Báo lỗi sự cố

Nội dung text Unit_4 reference.pdf

Unit 4: The Server Tier - PHP The Server Tier I Web server Web server is a computer system which receives the HTTP requests via TCP, which are used to distribute information on world wide web. Commonly a web browser or web crawler initiates communication by making HTTP request for a specific resource and the server response with the content of that resource or an error message if unable to do so. The main function of a web server is to store, process and deliver web pages to clients. The communication between client and server takes place using the Hypertext Transfer Protocol (HTTP). Pages delivered are most frequently HTML documents, which may include images,stylesheets, and scripts in addition to text content. Web servers are not always used for serving the world wide web. They can also be found embedded in devices such as printers,routers, webcams and serving only a local network Load Limits A Web server has defined load limits. It can handle only a limited number of concurrent client connections and it can serve only a certain maximum number of requests per second depending on: • its own setting • hardware and software limitation of OS • HTTP request type • content origin (static or dynamic) etc. When a Web server is near to or over its limits, it becomes unresponsive. Overload cause: At any time web servers can be overloaded because of: • Too much web traffic: when millions of clients connecting to the web site in a short interval overloaded can occur. • Distributed Denial of Service attacks • Computer worms that sometimes cause abnormal traffic because of millions of infected computers • Web servers (computers) partial unavailability. This can happen because of required or urgent maintenance or upgrade, hardware or software failures, back-end (e.g., database) failures, etc.; in these cases the remaining web servers get too much traffic and become overloaded. • Internet connection slowdowns, so that client requests are served more slowly and the number of connections increases so much that server limits are reached Anti overloaded technique To partially overcome above load limits and to prevent overload, most Web sites use common techniques. They are as follows :( web server) • Managing network traffic, by using: o Firewalls to block unwanted traffic coming from bad IP sources, o HTTP traffic managers to drop, redirect or rewrite requests having bad HTTP patterns, o Bandwidth management and traffic shaping. • By deploying web cache techniques.
• By adding more hardware resources (i.e. RAM, disks) to each computer. • By using different domain names to serve different (static and dynamic) content by separate Web servers etc. Creating a dynamic content We can create web content by using Server-side Scripting languages like ASP.Net,C#,PHP etc.Here we are going to discuss PHP Serverside scripting. PHP PHP stands for Hypertext Preprocessor. It is a server-side scripting language that is embedded in HTML. It is used to manage dynamic content, databases, session tracking, even build entire e-commerce sites. Simple example of PHP: Hello World As mentioned earlier, PHP is embedded in HTML. Variables in PHP All variables in PHP always begins with the dollar sign ($) and are followed by a concise, meaningful name.PHP has a total of eight data types which we use to construct variables. They are: • Integers • Doubles • Booleans • NULL • Strings • Arrays • Objects • Resources The first five are simple types and other are compound types. Simple example of declaring variables in PHP: $ int_var=12345; $ name="ronaldo"; $my_var=NULL; etc Rules for naming variables: • Variable names must begin with a letter or underscore character. • A variable name can consist of numbers, letters, underscores but you cannot use characters like + , - , % , ( , ) . & , etc • d - Represents the day of the month (01 to 31) • m - Represents a month (01 to 12) • Y - Represents a year (in four digits) • l (lowercase 'L') - Represents the day of the week https://www.w3schools.com/php/php_date.asp
Comment in PHP A comment is the portion of a program that exists only for the human reader.there are two types of comment in PHP,Single line comment and multi line comment. single line comment: they are used for short explanation. multiline comment:They are generally used to provide detailed explanations when necessary.Here is the example of comment Using control flow to control dynamic content generation we can use different technique to control flow for the dynamic content. Some of them are defined below: For loop : It is used when you know how many times you want to execute a statement or block of statement. syntax: for(start value, condition, increment/decrement){ //statements } While loop The while statement will execute a block of code if and as long as a test expression is true. syntax: while (condition) { // code to be executed; } do while loop The do...while statement will execute a block of code at least once. it then will repeat the loop as long as a condition is true. Syntax: do { //code to be executed; } while (condition); for each loop The foreach statement is used to loop through arrays. For each pass the value of the current array element is assigned to $value and the array pointer is moved by one and in the next pass next element will be processed.

Tài liệu liên quan

x
Báo cáo lỗi download
Nội dung báo cáo



Chất lượng file Download bị lỗi:
Họ tên:
Email:
Bình luận
Trong quá trình tải gặp lỗi, sự cố,.. hoặc có thắc mắc gì vui lòng để lại bình luận dưới đây. Xin cảm ơn.