{"id":21290,"date":"2021-05-10T16:26:41","date_gmt":"2021-05-10T16:26:41","guid":{"rendered":"https:\/\/www.devopsschool.com\/blog\/?p=21290"},"modified":"2021-10-28T05:52:41","modified_gmt":"2021-10-28T05:52:41","slug":"what-is-php-and-how-php-works","status":"publish","type":"post","link":"https:\/\/www.devopsschool.com\/blog\/what-is-php-and-how-php-works\/","title":{"rendered":"What is PHP? and How PHP works?"},"content":{"rendered":"\n<h3 class=\"wp-block-heading\"><span class=\"has-inline-color has-vivid-cyan-blue-color\"><strong>What is PHP?<\/strong><\/span><\/h3>\n\n\n\n<p>We can say that PHP is an open source programming and server scripting language that is particularly well adapted to Create Static web pages or Dynamic web pages or may be Web applications and can be includes in HTML codes. It&#8217;s used to handle complex content, databases, and session logging, as well as to create entire e-commerce websites. PHP is generally known as Hypertext preprocessor but it was first known as Personal Home Page. It was Designed in 1994 by the programmer named Rasmus Lerdorf. PHP would be relatively simple to learn but you have a clear knowledge of HTML first. PHP is compatible with a variety of databases, including MySQL, PostgreSQL, Oracle, Sybase, Informix, and Microsoft SQL Server, and can communicate with other services through protocols including LDAP, POP3, HTTP, IMAP, and COM. And, PHP operates on a variety of platforms, including Windows, Linux, Unix, and Mac OS X,etc.<\/p>\n\n\n\n<p><strong>Here is some Example of PHP Code!<\/strong><\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-1\" data-shcb-language-name=\"HTML, XML\" data-shcb-language-slug=\"xml\"><span><code class=\"hljs language-xml\"><span class=\"hljs-meta\">&lt;!DOCTYPE <span class=\"hljs-meta-keyword\">html<\/span>&gt;<\/span>\n<span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">html<\/span>&gt;<\/span>\n<span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">body<\/span>&gt;<\/span>\n\n<span class=\"php\"><span class=\"hljs-meta\">&lt;?php<\/span>\n<span class=\"hljs-keyword\">echo<\/span> <span class=\"hljs-string\">\"My first PHP script!\"<\/span>;\n<span class=\"hljs-meta\">?&gt;<\/span><\/span>\n\n<span class=\"hljs-tag\">&lt;\/<span class=\"hljs-name\">body<\/span>&gt;<\/span>\n<span class=\"hljs-tag\">&lt;\/<span class=\"hljs-name\">html<\/span>&gt;<\/span><\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-1\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">HTML, XML<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">xml<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p><\/p>\n\n\n\n<p><strong>For more understanding (Youtube referal) &#8211; <\/strong><\/p>\n\n\n\n<figure class=\"wp-block-embed is-type-video is-provider-youtube wp-block-embed-youtube wp-embed-aspect-16-9 wp-has-aspect-ratio\"><div class=\"wp-block-embed__wrapper\">\n<iframe loading=\"lazy\"  id=\"_ytid_43266\"  width=\"760\" height=\"427\"  data-origwidth=\"760\" data-origheight=\"427\" src=\"https:\/\/www.youtube.com\/embed\/Hqd8dZrw5bg?enablejsapi=1&#038;list=PLbGui_ZYuhigFdLdbSI2EM2MrJB7I0j-B&#038;index=1&#038;autoplay=0&#038;cc_load_policy=0&#038;cc_lang_pref=&#038;iv_load_policy=1&#038;loop=0&#038;rel=1&#038;fs=1&#038;playsinline=0&#038;autohide=2&#038;theme=dark&#038;color=red&#038;controls=1&#038;disablekb=0&#038;\" class=\"__youtube_prefs__  epyt-is-override  no-lazyload\" title=\"YouTube player\"  allow=\"fullscreen; accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share\" referrerpolicy=\"strict-origin-when-cross-origin\" allowfullscreen data-no-lazy=\"1\" data-skipgform_ajax_framebjll=\"\"><\/iframe>\n<\/div><\/figure>\n\n\n\n<p>Now the the first Question comes in every mind is &#8220;what are the Uses of PHP&#8221;? So I&#8217;m explaining this:<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong><span class=\"has-inline-color has-vivid-cyan-blue-color\">What are the Uses of PHP?<\/span><\/strong><\/h3>\n\n\n\n<p>The great thing about PHP is that it is incredibly basic for a beginner while still including a wealth of sophisticated features for a seasoned programmer. Don&#8217;t be intimidated by the long list of PHP&#8217;s capabilities. You should hop right in and begin writing basic scripts in a matter of hours.<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>PHP executes system operations, such as creating, opening, reading, writing, and closing files on a system.<\/li><li>PHP can manage formats, which means it can collect data from databases, save data to a file, send data by email, and return data to the user.<\/li><li>PHP allows you to add, erase, and change items in your database.<\/li><li>PHP&#8217;s core area is server-side scripting. If you want to practise at home as an amateur, this is the way to go.<\/li><li>Scripting from the command line is ideal for crone or Task Scheduler scripts. It&#8217;s also useful for basic text editing.<\/li><li>To communicate with every back-end \/ database server, such as MySQL.<\/li><li>You will use PHP to find today&#8217;s date and then create a monthly calendar.<\/li><li>PHP is commonly used to generate HTML code for web browsers.<\/li><li>If you have banner ads on your website, PHP can be used to rotate them randomly.<\/li><li>You may use php to limit a user&#8217;s access to a single web page.<\/li><li>You can build a login page for your user using PHP.<\/li><li>Connects a web browser to a database.<\/li><\/ul>\n\n\n\n<p><strong>So these are the uses of PHP, But, you didn&#8217;t know why we use PHP Language, let me explain you in following:<\/strong><\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"has-inline-color has-vivid-cyan-blue-color\"><strong>Why we use PHP Language?<\/strong><\/span><\/h3>\n\n\n\n<p>You&#8217;ve already heard of a few different programming languages, and you&#8217;re probably curious why we choose PHP as our poison for web programming. Because PHP has excellent online documentation and a solid function structure. As a result, the language is relatively simple to learn and has a large online community. There are a plethora of forums and guides on different PHP approaches and issues, so you should have no trouble finding assistance if you need it. Here are some basic point.<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>It operates on a variety of platforms, including Windows, Linux, and Unix.<\/li><li>It works for a variety of databases, including MySQL, Oracle, and PostgreSQL.<\/li><li>PHP is an open source programming language that is available to anyone for free.<\/li><li>When opposed to other languages such as JSP, ASP, and others, the learning curve is relatively short.<\/li><li>This language is simple to pick up and use, and it performs well on the server side.<\/li><li>It&#8217;s ideal for Web creation because it can be inserted right into the HTML code.<\/li><li>On different operating systems, it is often used in conjunction with Apache (the application server). It&#8217;s also compatible with Microsoft&#8217;s IIS on Windows.<\/li><li>PHP can be used to make interactive web sites as well.<\/li><li>Another advantage of PHP is that it is a server-side scripting language, which means that you only need to instal it on the server and that client computers requiring services from the server do not require PHP; just using a web browser is sufficient.<\/li><\/ul>\n\n\n\n<h3 class=\"wp-block-heading\"><strong><span class=\"has-inline-color has-vivid-cyan-blue-color\">How PHP works?<\/span><\/strong><\/h3>\n\n\n\n<p>The PHP programme interacts with the site server, which is the programme that sends out web pages to the rest of the world. When you type a URL into the address bar of your web browser, you&#8217;re telling the web server at that URL to email you an HTML file. The requested file is sent by the web server in response. The HTML file is read by your browser, and then shows the web page. When you press a source on a web page, you&#8217;re also requesting a file from the web server. Additionally, when you press a web page button that submits a form, the web server processes a file. When PHP is mounted, the procedure is exactly the same. You submit a file, and the web server, which happens to be running PHP, responds with HTML, because of PHP it all happens. You can under stand this through these steps:-<\/p>\n\n\n\n<p><strong>Step 1 &#8211;<\/strong> Client send a page request to the web server.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"498\" src=\"https:\/\/www.devopsschool.com\/blog\/wp-content\/uploads\/2021\/05\/How-PHP-works-Step-1-1024x498.jpg\" alt=\"\" class=\"wp-image-21291\" srcset=\"https:\/\/www.devopsschool.com\/blog\/wp-content\/uploads\/2021\/05\/How-PHP-works-Step-1-1024x498.jpg 1024w, https:\/\/www.devopsschool.com\/blog\/wp-content\/uploads\/2021\/05\/How-PHP-works-Step-1-300x146.jpg 300w, https:\/\/www.devopsschool.com\/blog\/wp-content\/uploads\/2021\/05\/How-PHP-works-Step-1-768x374.jpg 768w, https:\/\/www.devopsschool.com\/blog\/wp-content\/uploads\/2021\/05\/How-PHP-works-Step-1.jpg 1061w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p><strong>Step 2 &#8211;<\/strong> Web server forwards that request to the PHP interpreter.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"460\" src=\"https:\/\/www.devopsschool.com\/blog\/wp-content\/uploads\/2021\/05\/How-PHP-works-Step-2-1024x460.jpg\" alt=\"\" class=\"wp-image-21292\" srcset=\"https:\/\/www.devopsschool.com\/blog\/wp-content\/uploads\/2021\/05\/How-PHP-works-Step-2-1024x460.jpg 1024w, https:\/\/www.devopsschool.com\/blog\/wp-content\/uploads\/2021\/05\/How-PHP-works-Step-2-300x135.jpg 300w, https:\/\/www.devopsschool.com\/blog\/wp-content\/uploads\/2021\/05\/How-PHP-works-Step-2-768x345.jpg 768w, https:\/\/www.devopsschool.com\/blog\/wp-content\/uploads\/2021\/05\/How-PHP-works-Step-2.jpg 1115w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p><strong>Step 3 &#8211;<\/strong> Now PHP interpreter will take the Date from Database and responce it back to the Web server.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"472\" src=\"https:\/\/www.devopsschool.com\/blog\/wp-content\/uploads\/2021\/05\/How-PHP-works-Step-3-1024x472.jpg\" alt=\"\" class=\"wp-image-21293\" srcset=\"https:\/\/www.devopsschool.com\/blog\/wp-content\/uploads\/2021\/05\/How-PHP-works-Step-3-1024x472.jpg 1024w, https:\/\/www.devopsschool.com\/blog\/wp-content\/uploads\/2021\/05\/How-PHP-works-Step-3-300x138.jpg 300w, https:\/\/www.devopsschool.com\/blog\/wp-content\/uploads\/2021\/05\/How-PHP-works-Step-3-768x354.jpg 768w, https:\/\/www.devopsschool.com\/blog\/wp-content\/uploads\/2021\/05\/How-PHP-works-Step-3.jpg 1069w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p><strong>Step 4 &#8211;<\/strong> At last Web server responce to the client who has asked for the page request.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"489\" src=\"https:\/\/www.devopsschool.com\/blog\/wp-content\/uploads\/2021\/05\/How-PHP-works-Step-4-1024x489.jpg\" alt=\"\" class=\"wp-image-21294\" srcset=\"https:\/\/www.devopsschool.com\/blog\/wp-content\/uploads\/2021\/05\/How-PHP-works-Step-4-1024x489.jpg 1024w, https:\/\/www.devopsschool.com\/blog\/wp-content\/uploads\/2021\/05\/How-PHP-works-Step-4-300x143.jpg 300w, https:\/\/www.devopsschool.com\/blog\/wp-content\/uploads\/2021\/05\/How-PHP-works-Step-4-768x367.jpg 768w, https:\/\/www.devopsschool.com\/blog\/wp-content\/uploads\/2021\/05\/How-PHP-works-Step-4.jpg 1067w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p><strong>For better understanding you can have a look on this Video this will help you &#8211; YouTube referral<\/strong><\/p>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\"><p><span class=\"has-inline-color has-vivid-red-color\">In this Blog you I have discussed some of few points about PHP which is very basic but its necesary for all the programmers who is going to learn PHP. I have discussed many things such as What is PHP, what are the Uses of PHP, Why we use PHP Language and How PHP works with the steps. So, i hope this will help you to understand what PHP language really is! Thank you for your interest.<\/span><\/p><\/blockquote>\n\n\n<div class=\"epyt-gallery\" data-currpage=\"1\" id=\"epyt_gallery_47082\"><iframe loading=\"lazy\"  id=\"_ytid_13422\"  width=\"760\" height=\"427\"  data-origwidth=\"760\" data-origheight=\"427\" src=\"https:\/\/www.youtube.com\/embed\/?enablejsapi=1&#038;autoplay=0&#038;cc_load_policy=0&#038;cc_lang_pref=&#038;iv_load_policy=1&#038;loop=0&#038;rel=1&#038;fs=1&#038;playsinline=0&#038;autohide=2&#038;theme=dark&#038;color=red&#038;controls=1&#038;disablekb=0&#038;\" class=\"__youtube_prefs__  no-lazyload\" title=\"YouTube player\"  data-epytgalleryid=\"epyt_gallery_47082\"  allow=\"fullscreen; accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share\" referrerpolicy=\"strict-origin-when-cross-origin\" allowfullscreen data-no-lazy=\"1\" data-skipgform_ajax_framebjll=\"\"><\/iframe><div class=\"epyt-gallery-list\"><div>Sorry, there was a YouTube error.<\/div><\/div><\/div>","protected":false},"excerpt":{"rendered":"<p>What is PHP? We can say that PHP is an open source programming and server scripting language that is particularly well adapted to Create Static web pages or Dynamic web&#8230; <\/p>\n","protected":false},"author":25,"featured_media":21295,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_joinchat":[],"footnotes":""},"categories":[5150],"tags":[6595,4459,6603,493,6601,6604,177,6599,3902,685,6600,6597,3365,6602,6596,6594,6598],"class_list":["post-21290","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-php","tag-how-php-works-3","tag-html","tag-introduction-to-php","tag-mysql","tag-open-source-programming","tag-open-source-programming-language","tag-php","tag-php-language","tag-programming","tag-scripting-language","tag-server-scripting-language","tag-uses-of-php","tag-web-application","tag-web-pages","tag-what-are-the-uses-of-php","tag-what-is-php","tag-why-we-use-php-language"],"_links":{"self":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts\/21290","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/users\/25"}],"replies":[{"embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/comments?post=21290"}],"version-history":[{"count":4,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts\/21290\/revisions"}],"predecessor-version":[{"id":24391,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts\/21290\/revisions\/24391"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/media\/21295"}],"wp:attachment":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/media?parent=21290"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/categories?post=21290"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/tags?post=21290"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}