Show PHP Settings with phpinfo and Example PHP $_SERVER Display Page

View PHP Environment Configuration Settings and Superglobals on a Page

PHP is a great computer and web site scripting language and extremely popular. It is used primarily for developing interactive web sites and many use it for day-to-day programming tasks. There are several versions in general use and sometimes the configuration of PHP between servers and machines needs to be compared. The phpinfo() function is a one line solution to show the current live PHP set up. To show PHP settings simply create a one line PHP web file on the server containing <?php phpinfo(); ?> and point the browser at it. HTML tags are NOT required because the phpinfo() function pumps them out.

PHP LogoNote: phpinfo() outputs a lot of useful information, information that hackers find interesting so use it with care. Ideally do not have the phpinfo() page on a public facing web site. On the occasions you do take precautions to reduce information leakage. Put the page in a password protected directory, do not call it phpinfo.php as this is obvious to hackers (use something more obscure and a reminder to delete it when finished, e.g. quick-config-check.php), finally don’t forget to delete it when the PHP settings have been checked.

A PHP script will need access to other settings that PHP provides, often via system wide globals known as the superglobals. The $_SERVER array provides access to the _SERVER superglobal and is shown by phpinfo() in a table. Occasionally it can be worthwhile viewing such values from another PHP file. This can be done in a few lines of code. The following provides some details on showing PHP settings and global values in web pages.

Continue reading

WebMatrix Rename Site and Changing Virtual Folder Name

Renaming Websites and Folders in WebMatrix

Using a free package it is possible to develop a website on Windows using Microsoft WebMatrix. This program allows you to run a website on your local Windows computer. When a website is created in WebMatrix it will usually have the name EmptySiteX where X is a number. The name is the same as the folder in which the website files are stored. Where does WebMatrix create this folder? This folder is normally in My Web Sites in the logged on user’s Documents folder:

C:\Users\John Doe\Documents\My Web Sites\EmptySite1

(Tip: Using the WebMatrix settings this default location can be changed.)

Changing a website name in WebMatrix is easy. Open the website in WebMatrix with the Home tab selected. Ensure site folder is visible (select Files or the files icon on the left hand panel to see everything that makes up the site). Bring up the context menu (usually right-click) on the top level folder. Select Rename and enter the new name:

WebMatrix Rename Site

A brief status message is displayed at the bottom of WebMatrix. Then to completed the WebMatrix rename site an edit of the IIS Express applicationhost.config file is required. Continue reading