I recently install xampp on my desktop computer and encounter a few problems which I was able to overcome. I thought I would post them here with the hope of helping someone avoid some of the dilemmas that I went through. I am doing this, also, because I am forgetful and the next time I have to install Xampp I will have a dandy little resource here.
Let me say this, if you are a web developer or have been dabbling with web development and have not yet explore the usefulness of Xampp, you need to give it a try. Xampp basically gives you the tools and the power to run a full fledged server on your home computer, but more importantly, it gives you the ability to create dynamic database driven websites without the headache of login in and out of your hosting company's account.
Problems with connecting to port 80
After you have installed Xampp on your hard drive, running Mysql, Tomcat, Filezilla, Mercury and other add on components seems to be fairly easy. However, Apache, an essential component needed for your local server may refuse to run.
This usually happens because in some cases another program might be using port 80 ( the port Apache is assign to in C:\xampp\apache\conf\httpd.conf ) and Apache is unable to start. To rectify this issue, you will have to assign Apache to another port. Open your httpd.conf file in your apache folder with a text editor such as notepad and look for an instance of port 80 and change to port 81 or 79 and save.
If this does not work, look into your server error log to do a further diagnosis as to what specifically is causing the problem. You error log may be located here: C:\xampp\apache\logs\error.log
[caption id="attachment_239" align="alignnone" width="547" caption="Apache won't start. Change port 80 to 81 or 79"][/caption]
Problems with include file
If you are attempting to use an inc or include file (this is almost a given in php or database driven web development) and you are experiencing problems the solution might be a few edits in your php.ini file: C:\xampp\php\php.ini.
Open the file in a text editor and search for "allow_url_fopen = off" and change this to on. Also look for "allow_url_include = off" and change this to on as well. This should fix the problem
[caption id="attachment_240" align="alignnone" width="674" caption="Turn fopen in php.ini file on to fix include problem"][/caption]
Problems converting dynamic URLS into friendly URLS
Sometimes you may have your server up and running on the fly and your database ready to spit out information to the browser. However, you may not want a long string of unfriendly URL so you set up your .htaccess file to shorten your urls and make them more search engine friendly. You look stupefied as nothing seems to work.
To fix the problem take a look at your httpd.conf file Search for "#LoadModule rewrite_module modules/mod_rewrite.so" and uncomment it. This is the line of code that makes your rewrite rule work, so it needs to be active.
Problems with denied access for user ODBC
Some time during the use of Xampp you may get an error message like the one below.
Warning: mysql_query() [function.mysql-query]: Access denied for user 'ODBC'@'localhost' (using password: NO) in C:\xampp\htdocs\islandshoe\bridal\wedding_gowns.php on line 40
This can happen for 2 reasons:
1. You did not set up a username during the installation process so such error occurs because the server is looking for a username in order to connect and execute the code. Log on to the xampp control panel and click on apache admin, then click on security and set up your username and password.
2. Another reason this may be happening is that not all of your directories were set up to process include files, particularly if you are calling a config file for use from various folders. Try using your config file or include files in your root folder or document root to test it.
I say test, because for security reasons it is advisable to put include files in a directory located outside of the document root. Also, you can prevent this by specifying in your php.ini file which directories are used for includes.
Also, try specifying the location of the include file as an absolute path. If you are not sure of your absolute path try this <?php include $_SERVER['DOCUMENT_ROOT'] . '/include/file.php ?>
Love to hear from you: If you have installed xampp in the past and have different solutions to the errors and issues above, drop me a line below. If you are experiencing error issues drop me a line as well.