Home arrow XAMPP Manual - 2
XAMPP Windows Manual - 2



XAMPP Windows Manual - 2

Part 2 of the installation guide for the XAMPP dev server / LAN server package on a Windows PC.

On this page:
XAMPP configuration menu
Initialising MySQL
How to find my.ini and my.cnf
Uninstall XAMPP
Reinstall using a 'Safe Mode' process
MySQL and WinSQLMyAdmin Password
Install as a Service
ASP on XAMPP
Windows 2003 Server issues
Windows Server 2003 vs XAMPP
Additional services - FTP, WebDAV
XAMPP questions
Xamp tips

XAMPP configuration menu

After your flat site (standard html pages) or dynamic site (CMS, PHP-driven etc) is up and running correctly, you can access the Xamp configuration menu via:

 ../old/index.php

...if you placed the original files in a folder called <old> as advised. The original index.php page is also reproduced at:

/xampp/index.php

...and can be browser-accessed here, should the original be overwritten during a dynamic site install.

Please view the full documentation for the individual applications, at their respective websites. They are linked from /index.php. Xampp cannot contain the full latest documentation for these apps, so it is always preferable to obtain them from source. In practice, database setup may be found to be the most troublesome for new users; please therefore view the full documentation at the MySQL site.

The additional applications within Xampp – those not part of the core *AMP environment – increase the functionality, and improve the ease of use. It must be stated from the start that open-source applications, of all types, will never be as user-friendly as normal Windows programs. The reasons for this are multiple and complex. Therefore, users are expected to consult the FULL DOCUMENTATION at the respective application websites. Several of these programs may need user-customisation of the variables in order to work in other than default configuration – especially as regards security.

XAMPP cannot be used as a production server for livesites as it is wide open. There is even a question-mark here on the matter of using a dev server like this, on a LAN which has an Internet connection. It's true that some users harden XAMPP (or try to) and use it for production - but those issues are not for here.

Initialising MySQL

PhpMyAdmin is designed to be a user interface for MySQL. However, some initial MySQL variables may need to be set in advance, before phpMyAdmin can work. The .ini file is a possibility here.

The MySQL initial setup interface for Windows is called WinSQLMyAdmin, and may assist you here. It is accessed from the MySQL Admin button on the XAMPP control panel. If it flashes up and then closes, you need to click on the traffic-light icon in the system tray, which it has placed there, to open it again. In order for the system to work, all the .ini parameters must be correct and the SQL server connected and functioning.

BUT: WinSQLMyAdmin
needs to start up without MySQL running, or having been installed as a service, in order to create a new clean my.ini file.

Once again - if there are problems with database functionality:
WinSQLMyAdmin will need to create a new clean my.ini file. It cannot do that:
  • if MySQL is running
  • if MySQL is installed as a service
  • if a my.ini file already exists - as it won't overwrite it

If the XAMPP server does not function fully and correctly with a dynamic site, then the most likely cause is that the SQL service is faulty. This may be because the .ini file is incorrectly set up. The help files in WinSQLMyAdmin will assist you to correct this. Click the blue query (?) icon on the WinMySQLadmin control panel. If it cannot locate the Help file, drill down to:

\xampp\mysql\bin\

......and you will find it there (WinSQLMyAdmin.hlp).

The instructions in this help file are critical to getting the SQL service functioning correctly. In essence, you must enable the WinSQLMyAdmin Quick Setup panel (which is NOT the same as the main WinSQLMyAdmin panel). This creates its own .ini file and will get the service running correctly. You need to stop the SQL service (if installed), locate the my.ini and my.cnf files, rename them (for example to .bak or .old), then restart the WinSQLMyAdmin procedure.

How to find my.ini and my.cnf

To find these MySQL config files, do this:

1. Go to Folder Options: in any folder, go to the top horizontal main text menu >> Tools >> Folder Options

2. Enable 'View Hidden Files and Folders', and 'View Protected System Files', save & exit

3. Go to C Drive, locate and rename the my.ini file, which will now be visible. Rename it as my.ini.bak

4. Go to /xampp/msql/bin - locate and rename my.cnf, to my.cnf.bak

5. If there is no file my.cnf, but there is one called my - then that is the one you want. Rename it to my.cnf.bak

You can also find these files by Search. The my.cnf (MySQL config) file can be misidentified by Windows and may be named simply 'my', and/or be described as a Speed-Dial file, with the wrong icon (a modem or phone icon).

A file named 'my' - with or without a speed dial icon - is the MySQL configuration file. Rename it - this is safe to do as there is no file or folder in Windows called 'my'.

Reinstall using a 'Safe Mode' process

If it didn't work first time, re-install using another method - if the XAMPP server does not function correctly, or if the MySQL or phpMyAdmin panels do not work fully, then the best option is to uninstall XAMPP using the following full uninstall method, then re-install it.

How to uninstall XAMPP

Go to Control Panel >> Add/Remove Programs, and uninstall as per any Windows program.

Then go to
Program Files and delete the xampp folder.

Find and delete the my.ini and my.cnf (or 'my') files. This is CRITICAL – see above for the method.

Reboot the PC. It is now clean, and clear of XAMPP and MySQL components.

Then reinstall XAMPP like this:

  • Do not 'Install As A Service' XAMPP or any of its components, when asked by the installer.
  • Don't start Apache or MySQL - if they are running, stop them.
  • Do not set any usernames.
  • Do not set any passwords except for admin – set this to 'abc123' or something simple.
  • Leave the MySQL username as 'root', enter p/w 'abc123'.
  • First go to MySQL Admin on the XAMPP control panel, and start WinSQLMyAdmin (it kicks in automatically on first SQL boot, provided there are no my.ini OR my.cnf files (or a 'my' file).
  • On the first WinSQLMyAdmin screen, set u/n to 'root' and the p/w to 'abc123'.

MySQL and WinSQLMyAdmin Password

You then have a username of 'root' for MySQL and WinSQLMyAdmin; a u/n of 'admin' for XAMPP; a password of 'abc123' for all. This ensures a trouble-free setup, and when all is working OK you can then easily change u/n and p/w if necessary.

Install as a Service ?

Should you 'Install as a Service' or not? If your PC is mainly used as a server, then yes. If the PC mainly has other uses, and is occasionally used as a test server, then probably - no.

'As a Service' means that Xampp starts with Windows and runs as a main function of the machine. If you use the PC for other tasks then this probably isn't wanted as it loads the machine with several processes. But if you want to make sure that the server boot-up is trouble free, then you would do this.

It can be set in the install, or adjusted later via Windows >> Control Panel >> Administrative Tools.

ASP on XAMPP

You cannot use ASP pages or an ASP-based CMS on XAMPP because these need a Windows server. Even though the basic PC has a Windows OS, you have installed another layer on top, a server application, that does not use the Windows system or reference it in any way. There may be a commercially-available hack for this, but not free / open-source. If you want to run Windows server code like ASP - .NET then you need to run a Windows server, not Apache server, which is standard web PHP - MySQL technology.

You should get Windows Server 2003 / 2008 if you need to run ASP applications.

Windows 2003 / 2008 Server issues

If you have the specific Windows server package - Windows Server 2003 or 2008 - you don't need XAMPP. You can run ASP - .NET websites on this as this is what it is designed for. In addition this is production server technology, so as long as it is updated and maintained rigorously, this suits very well for production, ie web-facing use. ASP content management systems are designed for this - but you would probably also need MS SQL Server as well, the MS database application.

You can also use Windows Server 2003 to serve standard web technology based sites that use PHP or PHP - MySQL , such as normal PHP-type CMS. To do this you must install PHP and MySQL on the Windows server. This is a routine job though perhaps not for beginners. All Windows servers can have PHP and MySQL installed. In order to run a web-facing server you must upgrade, patch and maintain your server to professional levels or risk exploits. Common exploits include hacking a website and rigging it to download malware to any / all browsers that connect; and also compromising other sites on the server by XSS, cross-site scripting. In this way a badly-maintained server, and/or one with vulnerable web applications on it, can be turned into a malware farm. Web server security is not to be taken lightly, and these issues apply to all types of server.

Windows Server vs XAMPP vs LAMP server pros and cons

XAMPP is good for:
- development of standard web sites - those using flat HTML or PHP-MySQL dynamic technology
- LANserver use

...and bad for:
Can't handle ASP sites
Cannot be hardened and used for production safely except by an expert

Windows Server 2003 is good for:
- ASP-based websites and ASP CMS or ecommerce.
- web-facing duties (production)
...and it can handle PHP - MySQL apps, with additional software installed, but is not an optimal solution because there is no htaccess file, which many plugins use, especially for SEF URLs for example. Therefore although you can run a PHP CMS on a Windows server, it may not be possible to have SEF URLs or other vital facilities.

A normal LAMP server is good for:
- production
- flat HTML sites
- PHP - MySQL dynamic apps

...and bad for:
Cannot handle ASP sites


A web server is normally a Linux PC run for example on Red Hat or Centos, plus Apache, plus ancillary software including PHP, MySQL and Perl. However this cannot handle ASP websites of any kind.

A dedicated server may best use Lighttpd ('Lighty') or Nginx ('Engine-X') on Linux, as these specialist server apps (and similar alternatives) are best for single sites under heavy load, as their RAM and CPU usage efficiency is maximised for this purpose.


Additional services

FTP

FileZilla provides FTP server support. You can test out the upload / download of files in bulk, and carry out directory maintenance, with this facility. Go to the FileZilla folder to set this up. You may find that the FileZilla service needs to be started at the XAMPP Control Panel, even if Installed As A Service. On a LAN it may be simpler to create a shared folder on each PC and transfer files between them.

WebDAV

To use WebDAV applications you must load the mod_dav modules, as described in Apache Notes (see previous page).

XAMPP questions

Q: How to set up two instances of XAMPP on one server ?
A: It looks as though you want to have xamp run two or more sites. But it is not necessary to run several instances for this purpose, you can have 1,000 sites on one instance of XAMPP as it's a packaged LAMP server (just for development). See the multi-site explanations above.

A LAMP server can have thousands of sites on it. In fact we have seen 3,400 sites on one server at a cheap host (at least, there were 3,400 on the one IP, and that normally lines up with one server). There are stories about 30,000 sites on one server.


Q: Is XAMPP user-friendly ?
A: Definitely.

Although it is not aimed at novices, it is easy to use for basic tasks. It's a one-click install for most people; then just dump your web pages in the right folder, access the server via its LAN IP and you're away. You can install a hundred HTML sites if you want, or use CMS applications instead.


Q: Can I use XAMPP to serve a website on the Internet ?
A: You can use any server application for this.

However, security needs to be a consideration - maybe the main one. On XAMPP security is not a consideration at all, it's built for closed LANs, so that you can install a LAMP server on a Windows PC for local website development. Everything is designed to be wide open. It's an extremely clever and very useful device. For production (ie livesites), you are better off using a server that has had security built in as the first priority, not the last. There are plenty of people using xamp for production but they are taking a chance, as it can probably never be hardened to the level of a proper webserver.

XAMPP is not a proper webserver, it's a development tool. An expert might be able to harden it for production - but why would they do that when there are better tools available? If they are experts, they can use a real webserver instead. An expert can build and run a Centos - Lighttpd or Centos - NginX server for production, and that will do the job very nicely for high-load sites, it's all free, and essentially it can't be beat. A payware version is Red Hat - Zeus, equally good, posssibly better, who knows.

We know of no complete guide to hardening XAMPP for production. Given this, and the fact that you are asking basic questions about it, it would seem suicidal to use it in this way. OK for server techs and advanced computing techies perhaps, who would at least know what they are letting themselves in for. XAMPP has dozens of security holes that need patching to start with - and then you must monitor the security bulletins from the central orgs and upgrade PHP, MySQL, Perl, phpMyAdmin etc on a weekly basis. If you're up to that, give it a go.

Downside: fall down in one area, and your server will be exploited and one site will become a malware site, without you knowing. The other sites on the server will be exploited by XSS. The server becomes a malware farm and the search engines will ban all sites affected. You have to wipe the server, wipe the sites and start again. After this, you will be attacked with increased ferocity as you have proved easy to exploit - the search will be on for more loopholes, you're an easy target. And the search engines will watch you like a hawk.

Worth it? Up to you. This is what you pay a host $10 a year and up for. Seems like money well spent to me. What would you be doing that you can't pay $10 a year to someone to sort this out for you properly? Plus, you can get bulk domain deals if you are running loads of sites.

The majority of people who use XAMPP for production seem to be using it as a clan gameserver. This is understandable because to host this professionally would need VPS hosting @ about $30 a month. Also, the server might be online for only a few hours a week. The server will have no commercial webistes on it so there are less ways it can hurt the owner if it gets compromised. The main people who will suffer if the server is exploited are all other web users, not the owner.

XAMPP is for dev not production - unless maybe you are an Apache - PHP - MySQL geek who prefers Windows to Linux :)


Windows Server 2003 + XAMPP
Q:  Might it be possible to run W2K3 (Windows Server 2003) plus XAMPP, in order to create an easy-install dual-purpose server for both PHP and ASP sites?

A:  This might be possible but there are multiple issues - and certainly not for novice server techs.

The idea of using this as a production server doesn't bear thinking about. For a start there is no complete tutorial available anywhere on how to harden XAMPP for production - and it may not be possible, in any case (to the level of a normal LAMP server). Plus, you then have the same basic issue with the W2K3 server. Plus there may be additional issues - so the workload to keep it patched for production would be high if not impossible.


Q: How to use Dreamweaver and XAMPP ?
A: You can build a standard website, using the normal HTML web page form of construction, and place the pages on the XAMPP server.

This is a surprisingly common question. However, the server needs to be thought of in exactly the same way as a standard webhost's web server, except that it is locally available. Just as you would create web pages then upload them to the web server, you do the same here, but the server is a local machine. You can use the FileZilla FTP server for this but there are several other methods since the server / PC is likely to be physically close.

Of course, Dreamweaver itself cannot go on the server as it is a tool for creating webpages on your local PC. But if you just have the one PC and are running XAMPP on it, then in fact the two apps would be on the same machine, though not connected in any way. To 'sync & link' the server site with the dev site, you would need to use the FileZilla server app, and use 'localhost' as the FTP address. It would be a lot simpler just to drag 'n drop overwrite the files, since they are both on the same machine.

Xamp tips

Tip #1 - Comment-out
User variables: scripts sometimes need path variables and so on changed, for customisation. It will be useful for you to know that lines in scripts can be commented-out (temporarily disabled) by placing at the start of a line:

;      (semicolon - works on Windows .ini and registry files)
//     (2 x slash - works in PHP files)
#     (gate / hash / number symbol - works in htaccess files)

...or a tag enclosure of:

<!-- your text -->    (for HTML comments)
/* your text */        (for your comments in a CSS file)

These vary by code type. You should do this instead of deleting lines. You may have to remove the comment in some cases, to achieve full functionality.


Tip #2 - How to open .ini, .php, .cgi, .pl files
Open them either with Windows Notepad, or preferably a full-feature editor such as NoteTab Pro. This gives you the line numbers, which is essential for locating script problems, as the error message is often 'error at Line 599, incorrect language parameter.....' etc.

Tags and so on are also highlighted with a full-feature editor, which helps a lot. The Mozilla Firefox browser is also useful here. Disable word wrap when viewing code.

Did you find this guide useful?
If so, please consider linking to it. Thank you.

 

Please note that we do know how to spell XAMPP. It's sometimes spelt xamp, X AMP etc here so that people can still find the page easily in case of typos.

If you appreciate the help we have provided for you - which should solve some serious headaches if you are unlucky enough to be one of the small number of people who experience problems with the XAMPP install - you can do one thing for us, to repay some of the effort we put into this. Link to this page from your website, or from a social bookmark service. We don't promote this website in any way except to ask people to link if they find it helpful. And drop in to the forum and say Hi. You've probably noticed that this site is run by an SEO and webdev firm, but it's unusual and maybe unique - we don't promote it, the links are almost exclusively organic. We have enough work anyway :)

If you appreciate our work, then help us out like we helped you - it's how the web works. Thanks!
 
Web Business Managers