3

I'm on windows 8, I downloaded the wamp server and I have my index.php saved into the "www" folder within a subfolder called websites. When I'm on the localhost page, it displays the subfolder under "Your Projects" but when I click it, it takes me here

http://www.dnsrsearch.com/index.php?origURL=http%3A//websites/&r=http%3A//localhost/

and it says

"Why Am I Here? You entered an unknown web address that was used to present site suggestions that you may find useful. Clicking any of these suggestions provides you with search results, which may include relevant sponsored links.

If this service is not right for you, please visit your Preferences page to opt out. At any point in time, you can opt back in to the service by visiting your Preferences page.

If you have other questions about this service, please visit our FAQ."

Basically, it's taking me to a search engine and trying to show some suggestions for what I could've wanted, but I'm not trying to go to a website. I'm trying to access and display my test site so I can start practicing PHP. It's been really frustrating just getting started with this because I've come across all these different ways to do php and different problems and so far, using this wampserver seems like the best option but I'm stuck. Please please please help. This is driving me nuts!

Summary: I installed the WAMP server, I have my index.php saved in my www folder with its designated www subfolder (wamp\www\Websites\index.php), it displays on the localhost under my projects, but the link to display it doesn't work.

Any answers?

FOLLOWING UP A YEAR LATER

I appreciate the responses I've received. What I ended up doing to get the ball rolling (I went on a web development hiatus to pursue other things) and make things a lot easier to work with is I setup a LAMP server instead and it made the install process super easy and straight forward, and from there I've had no problems at all creating virtual hosts and making my websites work and having everything interact the way it should. If you're stuck where I was, setting up and using WAMP on windows is a lot more involved and touchy than setting it up on a linux system. On a linux system, you won't get a dedicated gui program like WAMP, but you'll have everything running in your operating system to handle it and it basically turns your computer into a local web server with php/sql support, and whatever else you'd like to add onto it. I'm using kali linux and it's working out fine for me. If you just want to dive into php without having to get over the huge hurdle on windows virtual hosts, I highly recommend just doing the research and setting it up on a linux system. If you have an additional hard drive, put linux on it. If you don't, setup a dual boot configuration on your drive so you'll have windows and linux. It helped me out a ton with learning how to make things on the backend reference each other the way I wanted to while also getting a significantly better understanding of it as I went. All you need installed is apache, mysql, and php and after setting everything up, it should work just fine on your local machine. Learning linux can seem scary at first, but this process is a lot more straight forward and easier to understand than doing it on windows.

Sani Evans
  • 81
  • 1
  • 1
  • 11

4 Answers4

13

I believe this is the best and easiest solution:

Open index.php in www folder and set

change line 30:$suppress_localhost = true;

to $suppress_localhost = false;

This will ensure the project is prefixed with your local host IP/name

Faizan
  • 1,847
  • 8
  • 40
  • 63
10

Just change the value in wamp/www/index.php line no 338.

Change this :

From

$projectContents .= '<li><a href="'.($suppress_localhost ? 'http://' : '').$file.'">'.$file.'</a></li>';

to

$projectContents .= '<li><a href="'.($suppress_localhost ? 'http://localhost/' : '').$file.'">'.$file.'</a></li>';
Gowri
  • 1,832
  • 3
  • 29
  • 53
Saravanan
  • 101
  • 1
  • 3
  • Perfect, worked for me. Thank you. – Anuj Garg Jun 19 '15 at 17:23
  • 1
    While this will work, it should be unadvised, since your code will fail when run outside of the local machine. Also, the Virtual hosts method could teach on how the DNS would work on the production enviromment. – Bonatti Jul 15 '15 at 17:05
2

Run the wamp server, Start apachee and enter the url as

http://localhost/websites/index.php
manitaz
  • 1,181
  • 2
  • 9
  • 26
  • Thank you for the response! I actually figured this out later on that day, but you are 100% right. I don't know why I didn't think to do that originally. But hey, you live and learn haha. – Sani Evans Aug 25 '14 at 00:21
  • Ok take it easy.......... – manitaz Aug 25 '14 at 05:55
0

There is a document on the WAMPServer forum HERE is the link that documents an amendment you can make to revert the Project links back to Pre 2.5 mechanisms

Look for the section entitled Revert WAMPServer 2.5 "Your Projects" links to pre 2.5 mechanism

Here is the amendment :-

Revert WAMPServer 2.5 "Your Projects" links to pre 2.5 mechanism

It would appear that some WAMPServer users cannot cope with creating Virtual Hosts for each of their sites/projects.

This is code that will be in the next version of WAMPServer so if you want your "Your Projects" menu to provide links in the form 'localhost/folder_name' rather than 'folder_name' so you dont have to create a simple Virtual Host definition, here is how it should be done.

I would enphasise, this is not the recommended mechanism. The only GOOD solution is to use the Virtual Host mechanism

However, making these changes will not harm WampServer and you can always set suppressLocalhost = "yes" to keep the WAMPServer2.5 mechanism.

  • Edit wamp/wampmanager.conf

In the section [main] add this line :

suppressLocalhost = "no"

Save the file

If this is set to "no" Your Project links will be in the form localhost/folder_name i.e. the pre WAMPServer 2.5 way. If this is set to "yes" Your Project links will be in the form folder_name and require a Virtual Hosts definitions to work.

  • Edit \wamp\www\index.php

Locate this line

$suppress_localhost = true;

and comment it out like so:

//$suppress_localhost = true;
  • Find this line

    $wampserverVersion = str_replace('"','',$result1); ajouter/add

and after that line add this code

//[modif oto] - On récupère la valeur de suppressLocalhost
preg_match('|suppressLocalhost = "(.*)"|',$wampConfFileContents,$result);
if($result[1] != "yes" )
    $suppress_localhost = false;
else
    $suppress_localhost = true;

Save this file

  • Edit /wamp/scripts/config.inc.php

Find this line

$c_editor = $wampConf['editor']; ajouter/add :

and after that line add

//[modif oto] Ajout variable suppressLocalhost
if($wampConf['suppressLocalhost'] != "yes" )
    $c_suppressLocalhost = false;
else
    $c_suppressLocalhost = true;

Save the file

  • Edit /wamp/scripts/refresh.php

Find this line

    {
        $myreplacesubmenuProjects .= 'Type: item; Caption: "'.$projectContents[$i].'"; Action: run; FileName: "'.$c_navigator.'"; Parameters: "['.$projectContents][$i].'/"; Glyph: 5

and REPLACE it with

    { //[modif oto] Support de suppressLocalhost dans wampmanager.conf
        $myreplacesubmenuProjects .= 'Type: item; Caption: "'.$projectContents[$i].'"; Action: run; FileName: "'.$c_navigator.'"; Parameters: "'.($c_suppressLocalhost ? "["]; : 'http://localhost/').$projectContents[$i].'/"; Glyph: 5

Save this file.

The changes are now complete.

Now restart WAMPServer

RiggsFolly
  • 93,638
  • 21
  • 103
  • 149