This site uses cookies from Google to deliver its services, to personalize ads and to analyze traffic. Information about your use of this site is shared with Google. By using this site, you agree to its use of cookies. Learn More

How To Start With Php?

How To Start With Php? PHP,PHP Basic How To Start With Php?

What is PHP?PHP stands for Hypertext Preprocessor and it is a server-side scripting language for web development. Server-side means PHP code execute on the server and the plain HTML result is sent to the browser. Script means it does not need to compile to run. PHP can also be embedded into HTML.

PHP can create the very awsome website and web application. And then you can easily learn PHP if you familiar with programming like C.

What do we need to run PHP in localhost?1. web server(Apache, IIS, etc.)
2. PHP (http://www.php.net/downloads.php)
3. MySQL (http://www.mysql.com/downloads/)

You can install these 3 programs one by one. You can get a lot of headache to do so. Today everything is easy to use. There are many packages that contain everything we need.

For Windows - WAMP, XAMPP, EasyPHP, AMPPS
For Mac - XAMPP, MAMP
For Linux - XAMPP, LAMP
For Solaris - XAMPP

These packages make your installation a breeze.

XAMPPAs for me, I use XAMPP server so I want to introduce you little about XAMPP. XAMPP can run all major Operating System.

Installation1. Go to the XAMPP home page from this link.
2. Choose your Operating System. As for me, I choose XAMPP for Windows.
3. Download the Installer.
4. Run your downloaded Installer.

That's all. Now you are ready to write your php website.

Running your ServerRun your XAMPP Control Panel from your Desktop or start menu.

How to start with PHP?

If you haven't run your Apache, click check box and start running like above screenshot.

Open you browser and run this address http://localhost/ and choose your language. You will see like below screenshot.
How to start with PHP?

Congratulations:
You have successfully installed XAMPP on this system!

Writing PHPLet's say hello to the world.
Open Nodepad. The best way to learn code is to code. So type below code in your Nodepad.

<?php echo "Hello World!"; ?> 

Save this file in your c:xampphtdocs folder as hello.php. You will need to change in "Save as type:" to "All Files" when you save your Nodepad file like below screenshot.

How to start with PHP?

Run your browser and check this address http://localhost/hello.php
You will see "Hello World!" on you browser window.

How does it work?As you have seen above code, our code started with <?php and ended with ?>. This tells your server to parse the information between them as PHP. It has three forms like below. You can use either of the options.


<? PHP Code In Here ?> <?php PHP Code In Here php?> <script language="php"> PHP Code In Here </script> 


The echo function will display the text between double code on the browser. Have you found a semicolon at the end of the statement? Each PHP statement must end with a semicolon.

Embedding withing HTMLAs you know, we are creating a website so you need to embed the PHP code withing HTML like below.


<html> <head> <title>My first PHP site</title> </head> <body> <?php echo "Hello World!"; ?> </body> </html> 

If you encounter any problem, don't hesitate to ask me.


0 Response to "How To Start With Php?"

Posting Komentar

Contact

Nama

Email *

Pesan *