• Home
  • Android
    • Apps
      • Android OS Build App
      • Compare Phone Contracts
        • Example 1
        • Example 2
        • Example 3
        • Example 4
        • Example 5
        • Example 6
      • Lump Sum Savings
  • Articles
  • Free Resources
    • Android Graphics Resources For Use In Apps
  • Index

Tekeye's Technology Blog

PHP on Windows Using WebMatrix Single Click Install

Articles - diana - February 21, 2015

Running PHP to Test Websites on Windows PCs

PHP is a programming language that is popular for for adding powerful features to websites. What does PHP mean? PHP originally stood for Personal Home Page (after its inventor, Rasmus Lerdorf, wanted more features for his personal website), but now it stands for PHP Hypertext Preprocessor (creating a recursive acronym, which programmers like). PHP is easy to set-up and run on a Windows PC using the free Microsoft WebMatrix, an Integrated Development Environment (IDE) for building websites.

With the free WebMatrix package PHP on Windows is a single click install and allows website testing using IIS Express (the version of Microsoft Internet Information Server for Windows clients). This tutorial assumes that WebMatrix is installed and running on your Windows 7 or higher PC. If not see our article Develop a Website on Windows Using Microsoft WebMatrix to set it up and get a basic website going.

With WebMatrix running and a website loaded the first step is to add a new file, a PHP file. Select New from the WebMatrix toolbar (or use the File then New and File menu options). Select the PHP option and in the Name box enter a relevant file name, here php-test.php is used.

This tutorial is simply going to test for PHP being active and running on the Windows PHP. PHP has a function that will output its configuration information. This function is called phpinfo(). By calling this function from a PHP file you can check to see that PHP is configured and working, ready for any other PHP code to be used in the website. (Once PHP is known to be working the call to phpinfo() can be removed for security reasons, i.e. do not give out technical details of your websites).

All PHP code is placed between special mark-up tags <?php and ?>. For the phpinfo() function all that is need in the whole file is <?php phpinfo(); ?> as the function itself outputs all the relevant HTML mark-up. Add phpinfo() to the second line of the new file, followed by a semi-colon (;), which is used to end all PHP code lines. Delete all other lines as they are not needed in this code file. The file should look like this:

 

Next a link to the new PHP file is added in the index.html file (you could also rename index.html to index.php and put the code in there). A link uses the HTML <a> tag, for anchor but commonly referred to as a hyper-link or just link. The Hypermedia Reference attribute, href, points to the item being linked to, in this case php-test.php.  In this example the link is added after the Hello World! message using the code:

1
<a href=“php-test.php”>PHP Info</a>

Here’s it in our basic example web page:

 

If the web site is now Run it is likely to display a HTTP Error 404.3 message because of the extension configuration, i.e. the web server, here IIS Express, does not recognise the PHP file. IIS Express is not configured for PHP.

 

To fix this problem click on the Site option at the bottom left of WebMatrix and then the Settings icon at top left. In the PHP Settings section click the Enable PHP check box.

 

If there is no PHP on Windows then WebMatrix will install it. The Install Product dialog appears. Follow the instructions clicking the Next button and accepting the license.

 

You will need to accept a User Account Control (UAC) dialog. After PHP has installed click OK to return to the files and run the website.

 

Click on the PHP Info link to run the PHP file and display the PHP configuration information.

 

PHP is now installed and running on the Windows machine. Where is PHP installed on Windows? There will be a sub-directory under C:\Program Files (x86)\IIS Express\PHP for each version of PHP installed. Each version has it’s own configuration file called php.ini, for example the phi.ini for PHP v5.5 on Windows is in C:\Program Files (x86)\IIS Express\PHP\v5.5.

PHP is a good templating language for web sites. The PHP code generates HTML that is sent to the users browser. The browser only gets the generate HTML and none of the code running at the server. This makes PHP useful for serving up feature rich web sites. To learn more about PHP there is a free online book available from Wikibooks.

Related posts:

  1. Show PHP Settings with phpinfo and Example PHP $_SERVER Display Page
  2. Develop a Website on Windows Using Microsoft WebMatrix
  3. Upgrade PHP for CentOS 6 Using Additional Repositories
  4. WebMatrix Rename Site and Changing Virtual Folder Name
 0 0

Share This Post!

About Author / diana

No Comment

Leave a Reply Cancel Reply

Your email address will not be published. Required fields are marked *

Previous Post
Next Post

About Me

Thanks for visits my website, hope you like my posts

Recent Posts

  • Blogging Guide – Start a Blog in 3 Easy Steps
  • This Changes Everything
  • How to make a website
  • How to Make a Weebly Website
  • Why Some Webcomics (and Some Web Businesses) Are Successful
  • Hostmonster Coupon Code and Discount Offer 2021
  • Frugal Tips for a Freelance Web Designer
  • Affiliate Millions: Make a Fortune using Search Marketing on Google and Beyond
  • Surefire SEO For New Websites
  • SEO – Using Bait to Attract Website Visitors
  • WEBSITE DESIGN TIPS
  • Xbox 360 Flashing
  • 12 best tools productivity business
  • Top android security apps available on market
  • How to View Instagram Private Accounts [2021 Guides]

Archives

  • April 2021
  • March 2021
  • February 2021
  • January 2021
  • January 2016
  • June 2015
  • April 2015
  • March 2015
  • February 2015
  • January 2015

Widget Area 1

Assign a Widget

Widget Area 2

Assign a Widget

Widget Area 3

Assign a Widget

Alison is a creative soft blog theme made with by angrygorilla.