Send the link below via email or IMCopy
Present to your audienceStart 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
Intro to PHP Installation - Web Servers
Transcript of Intro to PHP Installation - Web Servers
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!
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:
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
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://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:
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.