WAMP, Apache, PHP & MySQL

Hi all,

Ok I hope I can explain this, as I am pretty confused myself.

I am reading the book ‘Build Your Own Database Driven Website Using PHP & MySQL’. I installed WAMP, then installed Apache, PHP & MySQL, seperately (like in the book). After using them for a little while I decided to unistall everything and just use WAMP. Since reinstalling WAMP (about 5 times) I still have acces denied to phpMyAdmin (attachment 1) and my localhost shows a page containing the words ‘It works!’ (attachment 2).

I’m hoping someone here can help me sort this out, as I said I’m a bit confused at what’s going on, and I’m fairly new to this.

Thanks.

Al.

Allan,

UNinstall everything - specifically your individual daemons AND WAMP. Restart your computer (to clear the services). Reinstall. I’m not a fan of “canned programs” but WAMP should then reinstall everything.

The problem you’ve displayed is that you don’t have a root password in MySQL so PHPMyAdmin can’t function. Be sure you enter a password (for MySQL when asked.

Regards,

DK

Thanks for the reply.

OK, this may sound like a bit of a silly question but how do I delete daemons?

I have uninstalled everything that I can, but I might have missed something. I reinstalled WAMP, and phpMyAdmin is working but I still have the ‘It works!’ page for my localhost.

It sounds like you are OK now.

The “It works” page is just there to show you that the apache server is up. You need to setup a virtual host to point to your site. I don’t know if WAMP comes with Webmin? But Webmin is really great for helping to administrate apache; however, I don’t want to confuse you, so if WAMP provides a way for you to change/add/delete new websites then you need to make the relevant changes there.

Yea it seems like everything is working but I guess the thing that is annoying me, is when I was using WAMP on it’s own the localhost was showing up WAMP’s homepage, with server configuration etc. Then (after a few months) I had installed Apache, MySQL & PHP just like in the book, and that way when running Apache it showed the ‘it works’ page.

As I said I’m kinda new to this, but what I am trying to achieve now is to have the WAMP homepage up instead of the ‘it works’ page (which I have no idea how to do).

Probably the easiest way is to navigate in the file manager to your WAMP directory (default is c:\wamp\www). Open you will see your site files and folders inside this directory. Copy these files and folders and then navigate to your www directory in the path that apaches public or www directory is in the “How to …” book. You may have to rewrite the permissions depending on what WAMP had mapped the files and folders and what permissions exist on your regular Apache install.

Steve

I’ve just created a sub folder (test-wamp) with an index.html file inside, in the wamp/www/ directory and that seems to work.

I’ve typed in localhost/test-wamp/ in the browser and my html file is showing up. So it looks like the directory is still wamp/www/ but I don’t know which file to edit to get rid of the ‘it works’ page and show the default index.php page which was there when I reinsalled WAMP.

I hope I’m not being too annoying.

The ‘It Works’ page is a single .html file located in your htdocs folder. You have two options:

  1. replace the default apache index.htm(l) folder with your own index file
  2. change your http.conf like:
[LEFT][FONT=Consolas]<VirtualHost 127.0.0.1>[/FONT]
[FONT=Consolas]    ServerName [COLOR=#000000]localhost[/COLOR][/FONT]
[FONT=Consolas]    DocumentRoot 'C:\\wamp\\www\\my_site_folder'  [/FONT]
[FONT=Consolas]</VirtualHost>[/FONT][/LEFT]

[COLOR=#000000][FONT=georgia]

[/FONT][/COLOR]You then need to save the http.conf and restart apache. You can restart apache using the WAMP tools, or you may want to try the command line [COLOR=#000000]

[FONT=Courier]exec("C:\\wamp\\wampmanager.exe -restart");[/FONT]

[/COLOR][COLOR=#000000][FONT=georgia]or restart your computer.

BTW, you are not too annoying, SitePoint is a place for people to learn and share knowledge. You have some challenges that you are trying to sort out, you demonstrate that you are trying to troubleshoot the problem yourself. Feel free to ask more questions if we can be of service.

Regards,
Steve[/FONT][/COLOR]

Thanks, yet again.

I looked in httpd.conf and the only code I found that looked like it needed to be changed was:

ServerRoot “c:/wamp/bin/apache/apache2.2.22”

I changed it to - ServerRoot “c:/wamp/www/” and restarted, but it wouldn’t work (WAMP stayed in orange colour).

After a bit of messing around, I typed ‘localhost/index.php’ into the browser and it’s showing the WAMP homepage. So I think I’m happy enough with that, it’s all working, not exactly how I wanted it, but it’s working.

Thanks for your help Steve.

Also in the httpd.conf file I saw these, looks like all other directories are pointing to c:/wamp/www/

ServerName localhost:80
DocumentRoot “c:/wamp/www/”
<Directory “c:/wamp/www/”>

Hi,

I run apache and mysql in Linux, so I am not that familiar with the WAMP configuration although a little more familiar with LAMP which is similar. When trying to help I search in google for WAMP a virtualhost configuration and most links I found seemed to refer to a section in the http.conf that contain at least one host directive; normally in Linux installs the virtual host and host directives are at the bottom of the conf. You are likely to find the directive that maps to the host there somewhere.

If you have not already done so, I would recommend that you restore the ServerRoot “c:/wamp/bin/apache/apache2.2.22” as this is mapping to the apache executable, without this if you reboot your machine you may find that WAMP doesn’t work at all as it won’t be able to find this executable to start.

I found this thread Creating Virtual Hosts on WAMP Server where the blog suggests that you will find the host configuration in C:\wamp\bin\apache\apache2.2.11\conf\extra and open the file “httpd-vhosts.conf". If this is true in your WAMP install then you will likely find the existing host directive there.

Regards,
Steve

Yea I have changed the ServerRoot back to what it was. I looked in C:\wamp\bin\apache\apache2.2.22\conf\extra\httpd-vhost.conf and changed some of the code like it says in that link you gave me, but still ends up with the ‘It works’ html page.

Thanks for all your help, I’m sure if I was more knowledgable about this stuff, I would have sorted it a lot sooner.

Yes the conf file you attached is not causing the wrong route as these are both bogus virtual host settings. Can you trace in your WAMP’s http.conf where the virtual host or any host directives are located? Can you also open your tasks and then switch to the processes view and post a screen shot of the apache processes that are currently active? Can you also go into the admin interface of WAMP and select the http.conf their and scroll to the bottom of this file and copy any virtual host items that you can see?

Regards,
Steve

Hi Steve,

Thanks for replying, I was away all weekend and couldn’t get to my PC. I have just started up WAMP and clicked localhost and now it’s on the WAMP server homepage. I haven’t changed anything since I was last on. (Not that I can recall anyway).

Looks like it’s all sorted now.

Thanks for your help Steve, really appreciate it.

Just another quick question. It’s to do with the database upload size in phpMyAdmin.

It was set at about 2MB. I found this on the internet:

Find:
post_max_size = 8M
upload_max_filesize = 2M
max_execution_time = 30
max_input_time = 60
memory_limit = 8M

Change to:
post_max_size = 750M
upload_max_filesize = 750M
max_execution_time = 5000
max_input_time = 5000
memory_limit = 1000M

I went to the php.ini file located in the wamp folder - wamp/bin/php/php5.3.13/ (changed it and nothing happened)

I eventually changed the php.ini file through the WAMP icon at the bottom of the screen and now it works (I can upload my db which was over 2MB). Is that strange or normal?

Hi Allan,

Did you restart the Apache service after your changed the php.ini file in the WAMP folder? The actions connected to your WAMP icon will restart the service after you make a change.

The other possibility is that you may be using another php.ini file because of your earlier install of Apache using the book’s method. If you create a php info page - WAMP may have one built in - you can check for the path that is being used for php. You will find this next to the ‘Loaded Configuration File’. You may need to create an info page to do this:

  1. create a new PHP file in your WAMP folder
  2. in the file put <?php phpinfo(); ?>
  3. Navigate to the page in a browser

Steve

There is a phpinfo() page already installed with WAMP. I’ve looked at it and the directory under ‘Loaded Configuration File’ is different to the php.ini file I had changed.

Here is the ‘Loaded Configuration File’ path - C:\wamp\bin\apache\apache2.2.22\bin\php.ini

The file I had changed was C:\wamp\bin\php\php5.3.13\php.ini

Thanks Steve. It’s helping me understand where everything is and how it works. Does it matter that both those php.ini files are changed (they’re both the same anyway).

Hi,

Only the php.ini file listed in your WAMP phpinfo() page, the other php.ini is not doing anything )other than confusing you :wink: ). The Apache configuration files define the path to what php.ini file is used at any given time.

Glad this becoming clearer for you!

Regards,
Steve