author: Chris Price 2007-12-15 -- this site Previously on Pelaginox.com © 2006 - 20011 A3webtech XAMPP Windows Manual - 1Part 1 - XAMPP official docs Part 2 - XAMPP Windows Manual by A3webtech -- this page Part 3 - XAMPP Windows Manual page 2 - see menu link at right
Page contents: What is Xampp? XAMPP download Install XAMPP Connect to XAMPP on the LAN XAMPP with no router Set up a simple LAN Xampp folder location Building a new site Set up a single site Multi-Site on XAMPP CMS on XAMPP XAMPP CMS method 1 XAMPP CMS method 2 Transferring the CMS to a server
[on XAMPP Windows Manual page 2, following - see menu link at right] XAMPP configuration menu Initialising MySQL How to find my.ini and my.cnf ASP on XAMPP Uninstall XAMPP ...and more
This page, Part 1 of our Windows-XAMPP Guide, is entirely by A3webtech. It is not an official guide. It is an attempt to assist first-time users to get up and running quickly. It will help you especially if you have problems with MySQL initialisation, with the my.ini and my.cnf issues in WinSQLmyAdmin. It describes how to set up a site - how to connect to the server on a network - and how to install a CMS on XAMPP. What is Xampp?XAMPP for Windows turns any PC into a server. As stated in Part 1, it is suitable for a LANserver and development environment, not production (Internet use). A server = any PC with an HTML page-serving application or similar, that is, a program that receives requests from another connected computer and delivers web pages, files, or a game environment. Note that a server PC for local fileserving and website testing on a LAN can usually be any old, redundant PC, as its duties are not hard.
What PC can be used as a server ?
- If the load is not heavy then an obsolete PC can be used as a server.
- If the load is average, as on a well-used LAN in a large office (perhaps 10 users or more online), then a reasonably modern PC should be used - but nothing special is needed.
- If a server is a production webserver, then a PC with a good spec should be used. The critical areas (in order of importance) are RAM memory (at least 2GB needed), a top-quality fast hard disk (such as a Seagate one), and a fast CPU (whatever is currently a fast model but at a reasonable price - no need to go overboard).
XAMPP downloadRead about XAMPP here:http://www.apachefriends.org/en/xampp.htmlFor questions on compatibility, go here:http://www.apachefriends.org/winxampp/win32-compatibility-current.txt
Here we only discuss the Windows version. XAMPP installer versions are available for Windows, Linux, MacOS, Solaris and others. Make sure to download the correct version, which you can get here:www.apachefriends.org/en/xampp-windows.htmlYou can ask questions in the forum at ApacheFriends, who are the XAMPP developers (it's basically a sub-project of Apache). They are based in Germany, so the main forum boards are in German. Scroll down the page to find the boards in English. The XAMPP Windows forum is here:www.apachefriends.org/f/viewforum.php?f=16Install XAMPPFollow the installation routine on the previous page.
Then, set it up on the PC you installed it on. This is called a 'local machine' - it's one you can access directly - ie you can use the keyboard and see the screen. After this is done you can access the management via the network. (Of course, you can use remote access, but this is complicating matters.)### First run: set up XAMPP on a local machine initially ###A 'local machine' is a PC you have physical access to, and can access the keyboard & screen.Some options can only be accessed this way; this is how Xamp is designed to be used for the setting-up phase. When using a local machine as a server, this is termed localhost working. The following instruction applies to operation on the local machine, not a LAN / remote PC.
Note: the convention is that letters and numbers between the < and the > are typed.Boot up the server. Open the browser on the server (Internet Explorer for example) and type into the address bar <localhost/index.html>. You will see the example front page served by XAMPP. On some old browsers you may need to type the full version, <http://localhost/index.html>, but all modern browsers prefix it for you.The program's useful features can be accessed from the Windows Start Menu, Xampp program group on the local machine. You should go to the Xampp Control Panel and use all the controls there, for maximum functionality. Test the server group functionality, and set the variables, by going to index.php. Follow all the left navbar menu items and resolve all options here. After Xampp is set up correctly, you can then access via the network, ie from another PC which is connected to the server PC.An IP address on a local machine (the actual PC you are using) is commonly in the 127.0.0.1 range -- the last digit frequently 1 or somewhere between 1 and 10.
Connect to XAMPP on the LANOn a LAN, the IP address will likely be in the 192.168.0.1 range -- the last digit varying from 1 thru 10. So, to connect to your server from another PC on the network, you type into the browser address bar the following: 192.168.0.1/index.html
With an old browser, Internet Explorer 4 for instance, you might have to type <http://> at the start.
If using a LAN PC as a server (a PC connected to your own via a cable or WiFi network), this is termed local IP working. Some LANs use local IPs in the range 192.168.2.1 upward, or 192.168.0.100 upward. The router (switch, hub) determines this, so consult your router documentation for this (your wired or wireless router, that is to say your switch or WiFi router). Let's repeat this as it is a common question: Your router determines the IPs on your LAN - see its manual for IP addresses on your local network - XAMPP has no influence on this. Computers on your network have addresses allocated by the router / switch.
You can have dynamic IPs, which are changeable IPs allocated by the router's DHCP service, or you can choose static IPs, fixed ones that you allocate yourself. If you disable the DHCP LAN service, you will need to allocate fixed IPs. You might do this for several reasons, such as the ability to forward ports to one computer only, for accessing external services. But note that any additional PC joining the network cannot connect until you have allocated it an IP. If you get into trouble here, then go to this site for a lot of useful info on local IPs and routers:www.portforward.comNote that (on Windows) machine filepaths are backslashed:C:\Program Files\apacheNetwork filepaths (both LAN and Internet) are forward-slashed:http://127.0.0.1/index.phphttp://www.a3webtech.com/index.php XAMPP with no routerIf you have no router (ie switch, hub, WiFi modem router), don't worry, you could use a USB PC-to-PC cable. A USB LAN like this usually has different IPs from the norm: the IP could be 169.254.222.68 for instance, depending on the manufacturer (this IP range is for the GeneLink USB LAN cable).With no form of connection at all, XAMPP can still be used. Maybe you just have the one PC to work on. You can install the server application on your working PC. In this case the IP (the address of the server) is 127.0.0.1 -- so that's what you type into the address bar of your browser. It works, but is not ideal - a separate server is better. Set up a simple LANFor a simple, basic LAN - a local network - you only need some simple and inexpensive equipment. This is what you need: - any old PC - even an old 800MHz CPU PC will be suitable for light duties
- a basic LAN hub, for cabled use (not WiFi) - this is only around £10 / $15
- two LAN cables (to run from PC1 to the hub, and the hub to PC2)
- LAN cards, or onboard LANs, on each of the PCs
This hardware is not expensive. No software is needed apart from XAMPP or another server application on the PC that is designated as the server. No software is needed on the client PC (ie your main working one) apart from a browser. A browser, such as Firefox or IE, is the software that connects to a server. Since this is a closed LAN there are less security implications than for Internet use. You can connect as many PCs as you like (or other computers such as Macs). The capacity of the hub (aka switch) is the only limiting factor - the smallest is about 4 connections, and the largest in common use is 20. In practice there is no 'largest' as you can buy even larger ones, or chain them. A simple alternative for temporary use is a USB PC-to-PC cable. You cannot use an ordinary A-to-A USB cable here, it won't work. It needs a micro LAN hub in the middle. This may be cheaper if the alternative is that you have to buy all of the other components. However there are usability issues as this is not a standard LAN - the IP addresses are unusual for example. Xampp folder location After installation, the Xampp root folder (the root directory) can be found at:C:\Program Files\xampp\The 'webroot' or web page folder (which is always one level below the root directory) is at:C:\Program Files\xampp\htdocsThis folder is where you put files that can be accessed via the web (or in this case via the LAN). In theory, any files in this folder can be seen from the web / LAN. A folder on a server is usually termed a directory - there is no difference between a folder and a directory. Building a new siteFirst - clean up the web docs folder, /htdocs/. You can reorganise the web docs folder because on install it contains a lot of loose files that will be confusing after you place your own files in here.
- Create a new folder in htdocs, called /old/
- Put all the current loose files in htdocs into this (but not the folders such as forbidden etc)
- Leave the folders there, as they are
Your web pages should be placed in the \xampp\htdocs folder (not in \apache\htdocs\ as might normally be the case on a LAMP server, but this doesn't exist anyway). Replace the included test-page index.html with your own front page.
The front page of your site is correctly termed the index page. It can also be called the home page, start page etc. Its filename is often index.html, as that is the convention. It can also be an .htm or .php file. There are alternatives - but this is becoming too complex.
Note that you cannot run .asp pages on a LAMP server like this. Even though you are using a Windows PC, you have installed a separate server layer on top, and a standard server cannot run .asp or .net files.
Set up a single site Usually, to serve a single site, your index and other 'front end' pages are placed loose in the htdocs folder. Then, other folders are added here such as images and separate sections for your website.When using folders on a server, they are usually called directories. A directory = a folder, on a server. There is no difference. You can use either term, though for server use, it is more correct to use the term 'directory'. Here, we have used the term 'folder' more because it seemed better for these purposes, ie simpler.
So if you just have one site, and the pages are all loose in the webroot, then the URL for a single site may be:192.168.0.1/index.html ...depending on the router. On the server itself (accessing the local machine directly, on its own keyboard / screen) it will be:http://127.0.0.1/index.html
...assuming that you put a front page file in there, named index.html.
How to create an index page You can create an HTML page or use a CMS or similar application. To create an HTML page, just create a text file and name it 'index'. When saved it will therefore be index.txt, a standard text file. Type this text into it: Hello world. Then change the file extension (the bit after the dot) so that it becomes index.html, you now have an HTML index page. Or build it in an HTML editor, of course. Now when you access your site, you will see 'Hello world'.
Multi-Site on XAMPPWhen serving more than one website, each must be placed in its own folder. For multi-site use, then, you must put each 'site' in its own folder within /htdocs/. Therefore a local filepath to an index page for yoursite1.com, in a folder titled <yoursite1>, will be:\htdocs\yoursite1\index.html
The URL will be: 192.168.0.1/yoursite1
...although on older or non-standard browsers you might need to type: http://192.168.0.1/yoursite1/index.html
F or each additional site the local filepath is:
\htdocs\yoursite2\index.html
...and so on.
So the URLs for multiple sites, each in its own folder, in long form (though you should be able to get away with the shorter version of simply <IP/folder>) will be:http://192.168.0.1/yoursite1/index.htmlhttp://192.168.0.1/yoursite2/index.html...or on a local machine:http://127.0.0.1/yoursite1/index.htmlhttp://127.0.0.1/yoursite2/index.html Internet hosts solve this multi-site name problem by setting up the DNS for each site on their servers direct into each site's folder, and thus lose the 'yoursite1' part of the URL.When using multiple folders of web pages within a site (which is normal practice for standard HTML sites), these are termed directories. You must ensure your navigation links are correct between directory levels. How many sites on XAMPP ?
What is the maximum number of sites you can run on XAMPP? - An infinite number, but limited by the PC's resources. In other words it doesn't matter. The largest I heard of is 30,000 (yes, 30k). In practice a MySQL database should be limited to about 50,000 entries such as pages. If you want to install hundreds of HTML or CMS sites, that's OK, it will work fine - for development of course, or LAN use. For production, websites are limited as follows: - High-quality shared hosting has a max of 50 CMS / ecommerce / forum sites, for top performance (database-driven sites)
- For good-quality shared hosting, sites are limited to 200 max.
- For average performance, 300 or 400 sites per server are allowed.
Page load times, and occasional off-line incidents, increase for each step-up in the number of dynamic sites per server. They are approximately 100 times more resource-intensive than an HTML website. With database-driven sites then the database server will be heavily overloaded at times, with over 300 sites per server, and this results in very slow page loading or even offlines. But of course we are not talking about production servers here, XAMPP cannot be hardened for production except by an expert. And an expert would not be using it for that purpose, they would have no reason to do so if they can run a Linux / Apache or Linux / Nginx server. CMS on XAMPPXamp CMS set-up is easy. This is the best way to test and build your CMS before transferring it to the web host. XAMP contains the MySQL databases and PHP scripting you need for CMS functionality. In theory the number of DBs (databases) you can have is unlimited. They are set up, like on a webhost, with phpMyAdmin.
Dynamic site engines, such as CMS applications, should be placed in the htdocs folder, and the installation run from here (unless the application states otherwise). Such site engine installation MUST NOT BE STARTED until its database is set up and running correctly (unless the application itself installs the database during first install). It is likely to fail otherwise, since dynamic functionality depends on the database.Note that the 'pages' of a full-dynamic site - such as a CMS-driven site - do not exist: they are constructed on the fly by the dynamic application in conjunction with the database and server, and are therefore virtual pages. So, don't go looking for your web pages in htdocs - only the application folders (the CMS program itself) exist there. With a CMS or ecommerce application, THE PAGES DO NOT EXIST. They are built from the database, on-the-fly.There is more server overhead with this method, although this is irrelevant in a development environment. Xampp provides a fully-developed *AMP environment for local testing of CMS and ecommerce sites.XAMPP CMS method 1
Install the CMS files and folders LOOSE into the webroot. Do not put them in a folder (aka directory). Then, the test website URL will be: 192.168.0.1 This method ONLY works when there is just one site on the server. It is not advised. It is exactly what you do on a website, but on a test server you need to be able to run multiple sites. Before running the CMS installer (or compiling it or whatever else is needed), first set up a database for it using phpMyAdmin. XAMPP CMS method 2This is the recommended method for a test server. It is not normally used on a website since there is no point - and it also creates an extra directory level in the URL that is not wanted. This can be removed by htaccess script, but why bother as it is unnecessary. On a complex website with more than one dynamic application co-installed on the same webspace, though, there may be a good reason to use this in-directory method. Only one app can exist loose in the webroot at any time (there are conflicts between all the files, especially index.php and htaccess). Create a directory in the webroot called /yoursite1/ or whatever else you like. Create another called /yoursite2/. Install the test CMS or ecommerce set-ups into these folders. Of course, you can just place the entire CMS folder in there from somewhere else, and rename it to suit. Or, use FTP. Then, your CMS URLs are: 192.168.0.1/yoursite1192.168.0.1/yoursite2You may need to enter: 192.168.0.1/yoursite1/index.phpYou can have an unlimited number, in theory. You'll find el cheapo hosts in the States with around 3,500 sites on the same server, as an example. Most hosts limit the number of sites per server to 200 or 300. Quality hosts limit the number of sites on any one shared server to 50, otherwise site loading times slow down, partly due to overloaded database server issues. Transferring the CMS to a serverAfter testing and trialling, you can then transfer your CMS or ecommerce app to the webhost. You can do this manually - get a fileset and a DB dump; or you can use a dynamic site cloner such as XCLONER from Joomlaplug. This works on any PHP-MySQL webapp. This is a slightly complex area that rates another article, it isn't really part of the XAMPP material. Ask in our forum and we'll write it up... Did you find this page useful? If so, please consider linking to it. Thank you. The XAMPP Guide continues in Part 2 - see the menu link at top right [the page got to 6,000 words - again :) - and we had to split it]
|