phpadmin problem

Asked by Flanno

Hi,
I very new to xubuntu and have been trying to make a server for a bit of fun. I've been following the guide at
http://www.bit-tech.net/bits/2007/06/05/build_your_own_server/7 which has helped me most of the way but I've encoutered a problem when I get to point in using phpmyadmin and mysql. I follow the instructions in the site, however, when I enter "http://localhost" their is no "phpmyadmin" folder or "apache2-default" folder. When I type in "http://localhost/phpmyadmin" the login page comes up. So this is my first problem. How do I make the two links visible on my 'localhost' page?

Second problem is once I try and log into phpmyadmin, a pop up box appears from firefox asking me if I want to open or save to disk the file "index.php" when what it should be doing is logging me into phpmyadmin? correct? This did work at one point, but I encountered another problem in phpmyadmin so I tried to uninstall and reinstall some of the packages, but now it wont let me in at all.
What can I do?
Any help would be great.
Cheers,
Flanno

Question information

Language:
English Edit question
Status:
Solved
For:
Ubuntu phpmyadmin Edit question
Assignee:
No assignee Edit question
Solved by:
Drew Feragen
Solved:
Last query:
Last reply:
Revision history for this message
Drew Feragen (drewferagen) said :
#1

It looks to me that your apache install is not handling php files right anymore. Reinstalling packages only does so much, if there is a configuration issue, problems can persist. Luckily, there is the wonderful purge option in apt-get that removes all those pesky files.

I would suggest removing the php packages you have installed with:
sudo apt-get purge php5 php5-common libapache2-mod-php5 phpmyadmin

then do a reinstall og phpmyadmin.
sudo apt-get install phpmyadmin

then last, but not least I would restart apache:
sudo /etc/init.d/apache2 restart

If that doesn't fix it, I would recommend purging all LAMP packages, and starting from scratch.

Revision history for this message
Flanno (sean-benecke) said :
#2

Hi Drew,
Thanks for your response. I'm currently at work so I'll try your suggestion once I get home in a few hours. Just to verify, are all the codes you talked about entered in 'terminal'? And do they all work with each version of Xubuntu? I am currently using 7.10 (Gusty Gibbon).

I've noticed you know which packages were installed php...e.g. php5, php5-common etc. Is there are way to find out what was installed with apache and mysql?

Thanks for your help.
Cheers

Revision history for this message
Drew Feragen (drewferagen) said :
#3

These are all commands that you enter in the terminal. The apt-get commands should work on any flavor of Ubuntu, and any other Debian based distro.

As for knowing which packages to remove, first I ran:
sudo apt-get purge php5-common

it came back with the following:
The following packages will be REMOVED:
  libapache2-mod-php5* php5-common* php5-mcrypt* php5-mysql* phpmyadmin

So that is where I got that list... you can do the same with apache2 and mysql. Attempt to remove the most critical piece and it has to remove everything that depends on it... which makes our job easier.

To see what all you have installed you can also try the command 'dpkg --get-selections' to see *every* installed package... pair it with grep and you can find more info. So to search for things installed with the name apache you would use:
dpkg --get-selections | grep apache

To see what you can install, you can use the following:
apt-cache search apache

Good Luck! Let me know if any of this helps.

Revision history for this message
Flanno (sean-benecke) said :
#4

Just remembered something else that didn't work. When phpmyadmin did work the first time, I got to the stage (following http://www.bit-tech.net/bits/2007/06/05/build_your_own_server/7) where I was changing the password. The site told me to goto a database, then 'SQL' and to type as a query:
"SET PASSWORD FOR root@localhost=PASSWORD(‘MYNEWPASSWORD’);, of course changing “MYNEWPASSWORD” for something safer." However when I did this, I received an error #1044 which mentioned something about 'access denied' and that the password couldn't be changed to my requested password. Any ideas?
Cheers,

Revision history for this message
Flanno (sean-benecke) said :
#5

Drew,
I tried what you said and yes phpmyadmin now works and I can actually access it. However, I still have the same problem as before (see above - problem with password change). Any ideas? It was weird when I got to the login screen. The username had already been entered and it was a bunch of messed up symbols?? I pressed enter without entering a password and it let me in. I went back and tried "username: root, password: 'blank'" and that didn't work, but username: root@localhost, password: [blank] did work. I'm confused!?

The actual error I get with the password business reads:
Error
SQL Query:

SET PASSWORD FOR root@localhost = PASSWORD('rkeane')
MySQL said: ?
#1044 - Access denied for user ' '@'localhost to database 'mysql'

The site i've been using also says that at the address 'http://localhost', I should have a phpmyadmin folder and a apache2-default folder. The apach2-default folder isn't there, but if I type the address in (http://localhost/apache2-default i receive a page "FORBIDDEN". It's meant to say "It works!". Ideas?

I also remember playing around with a few other sites. One told me to enter this to get the phpmyadmin site to appear:

sudo ln -s /usr/share/phpmyadmin /var/www/phpmyadmin

which worked. I thought i'd try this as well for apache2-default so:

sudo ln -s/usr/share/ache2-default /var/www/apache2-default

im pretty sure the FORBIDDEN page occurred after this. How can I fix it?

Thanks for all your help again.
Cheers

Revision history for this message
Best Drew Feragen (drewferagen) said :
#6

I think what is happening with the mysql error is that it is logging you in as an anonymous user, the user you enter should be root, and not root@localhost. It just lets you in because it doesn't know what root@localhost is.

Here is a site to reset the root password in mysql:
http://ubuntu.flowconsult.at/en/mysql-set-change-reset-root-password/

basically you run:
sudo /etc/init.d/mysql stop
sudo mysqld --skip-grant-tables &
mysql -u root mysql
UPDATE user SET Password=PASSWORD('YOURNEWPASSWORD') WHERE User='root'; FLUSH PRIVILEGES; exit;
sudo /etc/init.d/mysql start

then you try logging in to phpmyadmin again as root (with your new password)

The forbidden page could be some wierd file permissions in /var/www (just guessing)
what does a 'ls -al /var/www' output for you?

It could also be that the symlink that was made for it with ln -s, points to something that doesn't exist, so it freaks out. on my system I got the default site by running:
sudo ln -s /usr/share/apache2/default-site/ /var/www/

then browsing to http://localhost/default-site/

Let me know how this goes for you.

you can also try

Revision history for this message
Flanno (sean-benecke) said :
#7

OK. The password change worked! I can now log into http://localhost/phpmyadmin using root as the username and my new set password. If I wanted to change my password ever again, would I follow the same process, or should the old way work now? I think now it recognises 'root' as the main user as now I can actually create databases, where as before, it said "no privileges".

I also tried your code for getting the apache folder to appear, and yes it worked! So now when I goto http://localhost I have two folders: phpmyadmin and apache2/default-site. When I click on the apache folder it comes up with "it works". However when I goto http:localhost/apache2-default it still says forbidden. Will this cause me problems further down the line?? When I used the code (sudo ln -s/usr/share/ache2-default /var/www/apache2-default) in the terminal to try and get it to appear previously, it just accepts it and goes to the next line. The terminal doesn't show any output of the actual code, so I don't actually know what it does. Do I need to remove the apache2-default??

Thanks again
Cheers

Revision history for this message
Drew Feragen (drewferagen) said :
#8

Great to hear that things are working again.

Now that you can log in as root to phpmyadmin, you can use the way you were originally trying to change the password ... if you forget the password or can't login, you have to use the other way.

Having the http://localhost/apache2-default come up as forbidden won't cause any trouble for you down the line, the only purpose that the default site serves is that it is a quick way to test and make sure that your web server is running. Normally it would be obvious that it is working or not. However, when you first install it there is no content to show, so they have a little stub index.html file for testing. Both of those can be safely removed from your /var/www folder, nothing relies on them to function.

the ln command is the link command, and the -s flag makes it a symbolic link aka symlink. Symlinks are cool, because you basically tell the filesystem to act like files that are elsewhere are actually where we want them...

so... 'sudo ln -s /usr/share/apache2/default-site/ /var/www/', tells it to make a symlink in the /var/www/ folder that points to /usr/share/apache2/default-site/.

When you look in /var/www/default-site/ with 'ls /var/www/default-site/' it really shows the contents of /usr/share/apache2/default-site/. If you just look at it with 'ls /var/www/default-site' (notice no / at the end), it will show you the details of where it points.

Now if you look at the symlink you had at /var/www/apache2-default ('ls /var/www/apache2-default') it shows that it points to nowhere, mine shows up as red text on gray background (signifying that its not a good link).

The code for removing the broken symlink is:
'rm /var/www/apache2-default'

some more detailed on symlinks: http://en.wikipedia.org/wiki/Symbolic_link

Revision history for this message
Flanno (sean-benecke) said :
#9

Thanks Drew.
That makes more sense now. Now I actually have a rough idea what the code is actually doing. I'm glad it all works now. Thanks again.

If you have any knowledge about accessing servers over the internet and streaming video files through a server to a tv, I've posted another question ([Question #45543]: How do I access my server through the internet?) If you feel like providing me with more xubuntu answers.haha
Cheers.

Revision history for this message
Flanno (sean-benecke) said :
#10

Thanks Drew Feragen, that solved my question.