Loading presentation...

Present Remotely

Send the link below via email or IM

Copy

Present to your audience

Start remote presentation

  • Invited audience members will follow you as you navigate and present
  • People invited to a presentation do not need a Prezi account
  • This link expires 10 minutes after you close the presentation
  • A maximum of 30 users can follow your presentation
  • Learn more about this feature in our knowledge base article

Do you really want to delete this prezi?

Neither you, nor the coeditors you shared it with will be able to recover it again.

DeleteCancel

Intro to PHP Installation - Web Servers

PHP and server-side scripting technologies are the next step in your web design education. What is PHP Hypertext Preprocessor and how do you run it?
by

Chintan Amrit

on 7 February 2013

Comments (0)

Please log in to add your comment.

Report abuse

Transcript of Intro to PHP Installation - Web Servers

PHP-Web Server Installation What is PHP? PHP stands for PHP Hypertext Preprocessor.

Yes, the acronym is IN the full name. It's called a recursive acronym and geeks think it's funny. What do you use it for? Despite the name, it does have some serious functionality. PHP is a server-side scripting language.

PHP is a programming language that can give the full power of a computer to your website. You can program login systems, searches, user profile systems, forms, calendars, email applications and bring many more useful functions to your site. Oh Cool! How do I start? You have to realize that PHP is a full programming language. You're going to be learning a lot of programming.

Netbeans can help!
http://netbeans.org/ OK: Where do we start? First, you need to understand how web pages are handled by the web server when a web link is clicked. 1.The client sends a request to the server using the HTTP protocol. 2.The server sends back the requested file. As the HTML page loads on the web browser, more requests are sent back to the server for images, javascripts or CSS files You probably knew this or could have figured it out pretty easily.

However, when we add PHP into the mix, things change.

PHP is code that is added to your HTML files that the server will run BEFORE sending the HTML file back to the client. 1.First the request goes out from the client for a .PHP page on a web server. 2.When the server receives the request it notices that it is for a .PHP page instead of an .HTML page. The server finds the appropriate page and opens the .php page without sending it. 3.The server then parses the page, that is, it goes through it line by line. Whenever it comes across any PHP code it runs it. If the PHP code creates some kind of output (like a table based on the contents of a database), the server will add the appropriate HTML code in the place of the PHP. 3.The server then parses the page, that is, it goes through it line by line. Whenever it comes across any PHP code, highlighted in red, it runs it. If the PHP code creates some kind of output, like a table based on the contents of a database, the server will add the appropriate HTML code in the place of the PHP. 4.During this process, the web server may communicate with a database server, which is present in other computer(s) dedicated solely to holding databases. The communication requires the SQL language and can put database information in the webpage or insert information from a form into the database. 5.Only when the server is completely finished parsing the page into HTML will it finally be sent back to the web browser that requested it. The final web page has just HTML in it, no PHP My PHP code will be deleted? No, it's fine. But everytime the page is run by the server, it will do the PHP commands and only send the HTML that is created. Your original PHP code will be left intact waiting to be accessed again.

So if you view one of your PHP pages in a browser and click View>Page Source, you will only see HTML; none of your PHP code will be there.

This is a security feature that is actually pretty good to have. Your PHP code will sometimes contain sensitive information like the username and password to your database, which you don't want the public to have. Installing a PHP Web Server Your computer does not run PHP code by default but the software to do this is free. You need three pieces of software:

Apache 2.4.3
MySQL 5.5.27
PHP 5.4.7

In this course we will be using XAMPP:
http://www.apachefriends.org/en/xampp.html (XAMPP is available for Linux, Windows and Macs). Mac users: beware of the different version of the 3!
You should know that there are many different languages other than PHP that are used to fill the niche of server-side scripting. You may also hear about ASP, .NET, VB, C# (see-sharp), Coldfusion or Java. PHP is the most popular and one that requires the least time/money and set up. XAMPP If you try and download PhP, MySQL and Apache software separately, they can be a pain to install and configure. Fortunately there is a software packages that combines all of them into one easy installer.

XAMPP installs all three components, configures them and installs software to manage them as well as several other open-source programs that are useful to web servers. I downloaded and installed XAMPP. Now what? A web server is not a stand alone application like you are used to with Word or Photoshop. There is no interface for the program but it is running in the background.

The program doesn't do anything until it is called. Apache kicks in when you request a webpage from it. Apache is watching a folder on your computer called ''htdocs'

The path should be
C:\xampp\htdocs

If you look in that folder, there are some PHP and HTML files and a couple of folders.

Now, if you put any files in the htdocs folder, Apache will serve them up (and run any PHP code) if you go to a special web address:

http://localhost/
or,
http://127.0.0.1 Understand this:

http://localhost (or http://127.0.0.1)
IS the htdocs folder.

So if you put a file in www called index.php, the address will be:
http://localhost/index.php

If you put an images/ folder in htdocs and a file in there called picture.jpg, the address will be:
http://localhost/images/picture.jpg. OK, so what does this mean for my PHP files? If you right click on a PHP file on your desktop or any other folder, you can edit it with NetBeans.

In order to see the output of your PHP files, you will have to have them in your htdocs folder and access them using http://localhost. XAMPP has a control program that allows you to turn on the different applications. PHP is actually a module within Apache, so turning on Apache turns on both programs. Now that you understand what software you need and how it works, we're ready to start learning the actual PHP language.
Full transcript