author: Chris Price 2007-12-15 -- this site
Previously on Pelaginox.com
© 2006 - 2008 A3webtech
XAMPP Windows Manual
Part 1 - XAMPP official docs Part 2 - XAMPP Windows Manual by A3webtech -- this page
This page, Part 2 of our 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.
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 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. Thanks!
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, that is, a program that
receives requests from another connected computer and delivers web
pages or files. Note that a server PC for local fileserving and website
testing on a LAN can be any old, redundant PC, if its duties are not
onerous. Read about XAMPP here: http://www.apachefriends.org/en/xampp.html
For questions on compatibility, go here: http://www.apachefriends.org/winxampp/win32-compatibility-current.txt
XAMPP download 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.html
You 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: http://www.apachefriends.org/f/viewforum.php?f=16
Install XAMPP Follow 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. After this is done you can access the management via the network.
### 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 in the current configuration. 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. 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 apps 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.
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. 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, especially when accessing a PC as a local machine. On a LAN,
the IP address will likely be in the 192.168.0.1 range -- the last
digit varying from 1 thru 10. This is typed into the browser address
bar as follows: <192.168.0.1/index.html>. With an old browser,
Internet Explorer 4 for instance, you might have to type
<http://> at the start. 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).
If you get into trouble here, then go to this site for a lot of useful info on local IPs: www.portforward.com
Note that (on Windows) machine filepaths are backslashed: C:\Program Files\apache
Network filepaths (both LAN and Internet) are forward-slashed: http://127.0.0.1/index.php http://www.yourdomain.com/index.html
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 - so the server application is on your working
PC. It works, but is not ideal.
Xampp folder location After installation, the Xampp root folder can be found at:
C:\Program Files\xampp\
The 'webroot' or web page folder is at:
C:\Program Files\xampp\htdocs
Building a new site
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). Your web pages should be placed in the
\xampp\htdocs folder; AND NOT IN \apache\htdocs\ as might normally be
the case (which doesn't exist anyway). Replace the included test-page
index.html with your own. 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. A folder = a
directory.
When 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
...and for each additional site: \htdocs\yoursite2\index.html ...and so on.
The URL for a single site, then, may be:
192.168.0.1/index.html -- depending on the router. On the server itself (the local machine) it will be:
http://127.0.0.1/index.html
Multi-Site on XAMPP
...and for multiple sites would be:
http://192.168.0.1/yoursite1/index.html
http://192.168.0.1/yoursite2/index.html
...or on a local machine:
http://127.0.0.1/yoursite1/index.html http://127.0.0.1/yoursite2/index.html
You will probably only need to type & Enter:
192.168.0.1/yoursite1
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, these are termed directories. You must
ensure your navigation links are correct between directory levels.
Dynamic
site engines, such as CMS applications, should also be placed here in
the htdocs folder, and the installation run from here (unless the
application states otherwise). Such site engine installation MUST NOT
BE STARTED until the 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
exist there. On a CMS or ecommerce application, THE PAGES DO NOT EXIST.
They are built from the database.
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 such sites.
XAMPP configuration menuAfter 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.
There is
a question-mark here on the matter of using a dev server like this, on
a LAN which has an Internet connection. 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; or 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 to .old, then restart the WinSQLMyAdmin procedure.
How to find my.ini and my.cnfTo do this:
1. Go to Folder Options. (In any folder, go to the top horizontal main text menu, choose Tools, choose Folder Options.)
2. Enable 'View Hidden Files and Folders', and 'View Protected System Files'.
3. Go to C Drive, locate and rename the my.ini file, which will now be visible. Name it 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).
Reinstall using 'Safe Mode' process
If
the XAMPP server still does not function correctly, or if the MySQL or
phpMyAdmin panels do not work fully, then the best option is to
uninstall XAMPP – remove the xampp folder in Program Files – find and
delete the my.ini and my or my.cnf files, WHICH IS CRITICAL – reboot
the PC – then reinstall XAMPP like this:
- Do not 'Install As A Service' XAMPP or any of its components, when asked by the installer.
- Do not set any usernames.
- Do not set any passwords except for admin – set this to 'abc123' or whatever you want.
- Leave the MySQL username as 'root', enter p/w 'abc123'.
- Don't start Apache or MySQL; if they are running, stop them.
- 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 / my.cnf FILES).
- On the first WinSQLMyAdmin screen, set u/n to 'root' and the p/w to 'abc123'.
MySQL and WinSQLMyAdmin PasswordYou 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; when all is working OK you can then
easily change u/n and p/w if necessary.
Additional services
FTP
FileZilla
provides FTP support for the server. 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.
XAMPP questions
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 this but they are taking a chance.
Xamp tips
Tip #1Comment-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) /* your text */ (CSS)
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 #2How 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 page useful?
If so, please consider linking to it. Thank you.
|