Turn on the XAMPP - Part 2

I hope everything is working fine, so that when you enter localhost in the address bar of your browser you are taken to the splash screen, from there you click on your language option and go to the XAMPP for Linux control panel. If you click on the Security option on the menu you will see a bunch of stuff with red UNSECURE tags on the end of them.

To fix these go to the terminal and enter

sudo /opt/lampp/lampp security

This runs the security setup.

The first question asks if you want a password set to access your pages. If you don’t do one, anyone that can get to your computer over the network will be able to see your pages.

Next it asks if you want to disable network access to MySQL - it’s probably a good idea to turn this off unless you really know what you are doing.

Next it asks about setting up passwords for MySQL/phpmyadmin and root access… a very good idea. Otherwise any program running could potentially get in to your database. Also it would be wise to change the default password for the FTP access.

Now if you try to run the sample programs, like the CD Collection, you will get an error to the effect of

Warning: mysql_connect() [function.mysql-connect]: Access denied for user ‘root’@'localhost’ (using password: NO) in /opt/lampp/htdocs/xampp/cds.php on line 64

Could not connect to database!
Is MySQL running or did you change the password?

This is because the code was written to use the default settings, which you have changed. If you edit the cds.php file to use your password (use sudo /opt/lampp/htdocs/xampp/cds.php to do so) it should work now.

Now by default, localhost points to /opt/lampp/htdocs/ - but you need root access to work on files there. So you can edit all your files through the terminal using sudo, or you can set up a link to another folder that you can access without using sudo. The best bet is to put it under your user folder, or home folder. First, decide what you want to call it. html, htdocs, public_html are all common - I use html. First you need to create the directory. You can do this from the File Browser, click the HOME button and create it there, or run the following in terminal;

mkdir ~/html

Next you link that to the lampp/htdocs folder using;

sudo ln -s ~/html /opt/lampp/htdocs/$USER

Now if your username is george, for example, you can point your browser to http://localhost/george and view whatever you put in that html folder.

You can start putting in sub-folders here to organize things .. say you have a folder for testing scripts in html/test, you would go to http://localhost/george/test - but you can make it even easier by setting up virtual domains.

There’s a very good posting about this on the Ubuntu Forums - So I’m not sure I’m going to try and duplicate it here. I can’t really offer much more than what is there right now.

Maybe I’ll add something about it later if I find something new to share.

Tags: , , , , , , ,

1 comment so far ↓

#1 equanime on 09.08.08 at 2:36 am

Very helpfull ty!!

Leave a Comment