php code example, php basic tutorial, Learn php fast, web page with php.
 
RoadDust's php basics tutorial
Learn php fast, make a web page with php.
 
php syntax, coding in php, php functions, php basics, php hello world code, EasyPHP trouble shooting.
 

Welcome to RoadDust's php tutorial. Here you will learn php fast and will master basic php code in no time

Create a web page with php.

Code a basic php script that displays "Hello World".

If you wish to learn php basics, you are more than likely familiar with HTML syntax. If you are not familiar with HTML or don't know what it is, you must first learn HTML basics. Once you know your HTML basics, you are ready for this php basic tutorial. The following example php code is the php hello world code. As tradition would have it, your first php should display "Hello World". Here is the example of a web page with php.

php syntax code example.

In the above example, the php code was put within a "?" tag in the head portion of the HTML. However, php code can be inserted anywhere as long as it is between "?" tags and somewhere between either the head tags or the body tags. Copy and paste the above php hello world code into any text editor and save the file as "helloworld.php". It is very important that you save the file with the ".php" extension. The name of the file is not important. Depending on the text editor you are using, you should select the option "All files" instead of "txt files" as you are saving. Otherwise, you may wind up with a file name "helloworld.php.txt" which is not a PHP file it is a text file named "helloworld.php".

Getting started with php basic tutorial.

Learn php fast, start by downloading EasyPHP.

Php is a server side scripting language. Unlike JavaScript you cannot simply run a php script through your web browser. Php must be run by a server. This is why testing the above php hello world code can get a little tricky. To get you started I will recommend that you download EasyPHP which, as its title suggests, makes PHP easy to run and test on your computer. The link bellow allows you to download this free software from Download.com which is totally safe.

Download EasyPHP

As you download you can either click on "Open" and follow the installation instructions or you can click on "Save as" and then double click on the icon of the downloaded file where you saved it. Either way, follow the instructions for proper installation.

Php basic tutorial, using Easy PHP.

Running the php code example with EasyPHP.

During EasyPHP's installation a shortcut to EasyPHP will be created in your "Start/Programs/EasyPHP" directory. When you launch EasyPHP, an icon will appear in the system tray. If you click on this icon you will have access to several options. The following options may vary depending on your version of EasyPHP.

  • Log file: This will show you a report of errors generated by Apache and MySQL.
  • Configuration : Allows you to configure EasyPHP settings.
  • Web local : Opens "http://localhost/" which is the address that you put in your web browser to see your php files.
  • Start/Stop : Allows you to start or stop the Apache server.
  • Quit : Close EasyPHP.

Now launch EasyPHP, click on the system tray icon, and click on the start/stop option. You are now running the server. You should see a little blinking light on the Big "E" of EasyPHP which means the server is running. To run the php code example of the php hello world code that I gave you above, all you have to do is put your PHP file in the "www" folder located in "c:/program files/easyPHP". Keep in mind that the EasyPHP folder will have a version number attached to it (EX: c:/program files/EasyPHP1-7). In this folder you will find a folder named "www". Put your PHP file in this folder. Next step is to click on the "Web local" option of your EasyPHP which will display the contents of your "www" folder. You could also type "http://localhost/" in your web browser for the same result. You can now display the "php hello world code" by double clicking on the helloworld.php file we created earlyer wich should be displayed on your screen. Depending on the version you should be looking at a bluish screen that says EasyPHP and shows links to the files in your "www" folder. Once you click on the "helloworld.php" file we created earlier you should get a web page that says "Hello World".

Php hello world code, trouble shooting

EasyPHP trouble shooting. Why is my EasyPHP server not working?

Is your EasyPHP running?
You should see the EasyPHP icon in your system tray (Which, if you are on a windows platform, is the bar at the complete bottom of your screen, the one that contains the start button, just look at the complete right of this bar and you will see little icons next to the time). You should see the "E" icon with a little red blinking light. If there is no Icon, your EasyPHP server is not started. Go in "Start/Programs/EasyPHP" and click on EasyPHP to start the server. If you see the Icon, right click on it and chose "start/stop". You should now have the EasyPHP icon with a blinking red light. If you did not have this before this may fix your problem.

Are you running another server?
You can't run more than one virtual server at once unless you know what you are doing and have specifically changed you settings to allow the servers to run on different ports. If you are running another virtual server close it and try again. I am not 100% sure but I believe you may be running the IIS server as I think I had that problem a long time ago and you can turn it off somewhere in the "Control panel / Administrative tools".

Did EasyPHP use to work but not anymore?
If this is the case you may have deleted some files that are required to run EasyPHP or something else may have happened that conflicted with EasyPHP. If this is the case you may try re-installing EasyPHP on your computer.

Last resort for the desperate man
If nothing is working and you are about to smash your keyboard, kick your computer and have already given your monitor the finger several times, there’s an other way. As you must have figured out by now, your web host must support PHP for you to be able to run it on your web page. Therefore, you can upload your php hello world code on to your web host and test it online. Using WS_FTP makes this really fast anyway and therefore this is not such a bad solution. If you cannot get the Hello World to display this way then it is simply because your web host does not support PHP.

Further your PHP knowledge with php code examples.

Php basic tutorial on how to learn php fast.

Now that you know how to make a web page with php, you should further your PHP knowledge by learning more php syntax. You will see that coding in php goes far beyond the above php hello world code. I will add tons of PHP tutorial information in the near future as I update this page. I will include things such as php basics, php functions, making blogs with PHP and more.