WAMP virtual host displays in Chrome, but Internet Explorer says "Page can't be displayed" - apache

I installed WAMP and followed this guide to set up virtual hosts. In both Google Chrome and Internet Explorer, http://localhost gets me to "WAMPSERVER homepage" with my virtual host listed under "Your Projects."
Clicking that link to http://mysite.local in Chome brings me to my site as expected.
Clicking that link in Internet Explorer displays the following message instead.
This page can’t be displayed
•Make sure the web address http://mysite.local is correct.
•Look for the page with your search engine.
•Refresh the page in a few minutes.
Since I can see the WAMPSERVER homepage as expected in both browsers, I don't think there's a problem with my WAMP installation. Since my virtual host is working in Chrome, I think it must be configured properly in Apache and in my Windows hosts file.
I just don't understand why Internet Explorer isn't working with my virtual host like I expect it to, and the "Page can't be displayed" message doesn't give me anything helpful to work with.
Does anyone have any suggestions for me? I'd greatly appreciate any pointers or links to other guides I can try. Thanks in advance for any replies!

There's several reasons WAMP/MAMP may not work on a local environment, I'll try to list a few reasons here:
Which httpd.conf?
There are sometimes multiple httpd.conf files that can cause things to go a little bit funny. MAMP/WAMP usually tend to keep all their configuration files within a conf/ directory however, that doesn't mean to say some other httpd.conf file is being used...
You can also run this command on Linux based systems to see which one is being used:
apache2ctl -V | grep SERVER_CONFIG_FILE
vhosts definitions not included in httpd.conf
In the httpd.conf file, there's a line to include the vhosts definitions file, it should be uncommented:
# Virtual hosts
# Include conf/extra/httpd-vhosts.conf // remove the #
Incorrect vhosts definitions
Vhosts need to be defined as follows:
<VirtualHost *>
DocumentRoot "C:/path/to/your/local/site"
ServerName mydomain.local
</VirtualHost>
Hosts file
On OS X/Linux systems this can be found at etc/hosts. Edit that to reflect below (note, you'll need to be root)
127.0.0.1 mysite.local
On windows systems, it can be found in %SystemRoot%\System32\drivers\etc\hosts.
Browser caches
Browser caches always cause an issue with local servers/development. It's worth working with incognito mode on, or deleting all browser caches each and every time you open it up. There's a few plugins available for most browsers that should help too.
Other points to note
Whenever you edit anything to do with httpd.conf, vhosts, hosts file - WAMP/MAMP/Apache needs to be restarted. It's a good idea to shut the server down before doing the changes.
You mentioned that there was a hardcoded link in one/some of your files. It's generally regarded as bad practise to do that for this exact reason. Your code is less portable and can 'break' on other systems. I'd suggest using PHP's __FILE__ or similar to achieve what you want.
Alternatively you could set up local configuration files for your app that are only included when they're present. Have a look at this for a good example of such a set up.
Log everything. Check the logs regularly too.

Related

Apache2 will only serve small files

I just know this is one of those questions where the solution should have been obvious and I'm going to feel like an idiot but I'm stuck.
I've set up a basic apache2 web sever under openSUSE Leap 15.1 on my LAN with a single virtual host (for the moment).
If I create a simple html file of 255 bytes or less a browser on another workstation picks it up without problem. If the file gets to anything larger than 255 bytes apache doesn't serve it. The GET request shows up on the server but nothing shows in Firefox, Konqueror at least gives me a 1b Object not found error.
I should say that running a browser on the server itself shows all these files perfectly well should I use 127.0.0.1, localhost or the server name in the URL.
Is this an Apache2 directive I've missed or something else entirely?
After setting the LogLevel to trace1 and then hunting around on the web I came across what appears to be the solution. Set the Apache directive ...
EnableSendfile Off
Apparently Apache is compiled with this set to On and the kernel sendfile doesn't do the job. Not a detailed explanation I know but I haven't followed this all the way through - I just needed to get Apache working!

WAMP localhost and phpmyadmin setup

I have inherited a WAMP setup, but needed my http://localhost to point to a different directory "C:/Users/[user.name]/htdocs" due to many dependencies.
I made the following changes in httpd.conf
DocumentRoot "C:/Users/[user.name]/htdocs"
<Directory "C:/Users/[user.name]/htdocs">
where the original path was "c:/wamp/www/"
Now the WAMP default path for phpMyAdmin http://localhost/phpMyAdmin is not working anymore.
Is it possible to fix that via either C:\wamp\alias\phpmyadmin.conf or httpd-vhosts.conf somehow?
Can I suggest a better solution to your requirement to have a site running that does not live in the WAMPServer default location i.e. \wamp\www or \wamp\www\somefolder
If you revert all your httpd.conf changes to the out of the box state and then create a Virtual Host to run the site you have located in your \user.... folder.
Virtual Hosts are a standard Apache feature that allows you to run may sites from a single instance of Apache, a bit like a shared hosting package setup.
You would then have the benefits of the WAMPServer homepage running on localhost and all the other alias's tools as well.
You can then run your site using a nice url for example sitename.dev and the virtual host definition also allows you to setup any site specific requirements without effecting any other site you may want to run.
There is a HowTo Setup Virtual Hosts here on SO

How do I find my httpd.conf file?

*Edit: Anyone who's using MAMP PRO on a Mac running Mac OS X Lion may find it helpful to know that I finally tracked down my httpd.conf file in my personal library at Application Support > appsolute > MAMP PRO > httpd.conf. The reason I couldn't find it with a normal search is that it's a hidden directory. To access it, open Finder, Choose Go > Go To Folder, then type in ~/Library After tracking it down, you may then discover that it's almost impossible to edit your httpd.conf file. ); *
This is a weird one. I'm using MAMP on a Mac and want to modify my httpd.conf file so it defaults my URL's to lower case. So I navigated to Applications > MAMP > conf > apache > httpd.conf and added this line of code:
RewriteMap tolower int:tolower
I then modified one of my .htaccess files accordingly, but nothing happened. (Yes, I restarted my servers.)
I then reopened my httpd.conf file and added this code, which I understand is supposed to display "verbose" messages in my log file:
LogLevel trace8
I then opened my log file # Application > MAMP > logs > apache_error.log. There's code associated with the web pages I most recently visited, but they're just generic messages - not "verbose" messages.
Someone who understands Apache far better than me told me this indicates that the httpd.conf file I modified isn't being used by my server or sites. In other words, there must be another httpd.conf file out there somewhere.
Sure enough, I typed httpd.conf into Apple's finder and found half a dozens files with that name. I don't know where they came from; I recently tried to install Drupal and Aqquia, so that might be where some of them originated.
Anyway, I added the code (including LogLevel trace8) to EVERY httpd.conf file, restarted my servers, and I STILL don't see any changes on my websites, and I still just see generic code in my log file.
I'm completely snowed. It looks like the httpd.conf file in my MAMP folder is out of the loop, yet the Apache log file in the same folder is being used...or can errors be written to more than one Apache log file at the same time?
If I rename the httpd.conf file in my MAMP folder and restart my servers, my sites display fine, further suggesting that this httpd.conf is outside the flow. Yet if I rename a file that sits beside it named mime.types, my web pages don't display.
Anyway, does anyone have any idea how I can figure out what's going on?
If not, then can you advise me on Plan B? If I can't find my httpd.conf file, then I'll have to abandon ship and just do it online. I've found the path to my online httpd.conf file. I don't know how to open online files, but I assume I can copy it to my computer with an ftp program, open it and modify it, then publish it online.
So here are my questions: Am I correct in understanding that I can safely add the code RewriteMap tolower int:tolower to my online httpd.conf file without affecting any of my websites UNTIL I also modify a .htaccess file(s)? And if I modify my online config file, do i have to restart the server, just as I do on my computer?
Thanks.
First, use the ps command to find the full path to the running Apache process:
$ ps ax | grep httpd
28 ?? Ss 3:01.99 /usr/sbin/httpd -D FOREGROUND
On this system, Apache is /usr/sbin/httpd.
Second, run that binary with the -V option to show its configuration. This should include the path to the config file.
$ /usr/sbin/httpd -V
...
Server compiled with....
..
-D SERVER_CONFIG_FILE="/private/etc/apache2/httpd.conf"
On this system, the running copy of Apache reads its config from /private/etc/apache2/httpd.conf.

Wamp: Phpmyadmin shows blank page, localhost page is working [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 2 years ago.
Improve this question
I have installed Wamp on my computer (Win 8).
Since I had IIS installed also I changed the ports to 8080 instead in apache -> httpd.conf. Both on Listen and on ServerName. And I unchecked the IIS thing in Windows programs. (Sorry don't know what it's called my OS is in Swedish).
My hosts file only has: 127.0.0.1 localhost.
When I did that I got the localhost:8080 to work.
But when I try to access phpmyadmin it just shows a blank page. I have also tried opening Wamp as an administrator. And I have re-installed Wamp multiple times.
Now I need some help, feel like I am running out of options. I am a newbie so please don't make it complicated =) Thanks!
Try launching phpMyAdmin using
http://localhost:8080/phpmyadmin
If that works then its an IPV4/IPV6 confusion, Apache now listens to both ip address ranges by default and browsers tend to pick either IPV4 or IPV6 addresses for no apparent reasons. Add this line to your HOSTS file to associate localhost with the IPV6 loopback address
::1 localhost
Also check the phpMyAdmin config security, edit ?\wamp\alias\phpmyadmin.conf
If you are using Apache 2.2.x, change the Allow it to look like this
<Directory "c:/wamp/apps/phpmyadmin3.5.1/">
Options Indexes FollowSymLinks MultiViews
AllowOverride all
Order Deny,Allow
Deny from all
Allow from 127.0.0.1 localhost ::1
</Directory>
If you are using Apache 2.4.x, change the whole Directory section to look like this
<Directory "d:/wamp/apps/phpmyadmin4.0.4/">
Options Indexes FollowSymLinks ExecCGI
AllowOverride all
Require local
</Directory>
If you are using sqlbuddy or webgrind their config files also need changing in the same way in ?:\wamp\alias\...
For me it has some problems with sessions... so first, try to login with another browser like Firefox or something else and if it works in that browser you have to clear your browser cache ...
simply use Ctrl+F5 for example 3 times or clear all cookies from your browser settings...
This happened to me and I fixed it by quitting Skype (I guess it was a port collision) and then stopping all services then turning them back on.
I ended up with installing XAMPP and found out that it was a problem with port 443. Then I just opened XAMPP as administrator and it magically worked! =)
I realize that this is an old question, but I came across a situation that wasn't covered by the above solutions, so I'll put it here for posterity:
If you're using phpMyAdmin < 4.2.12, make sure your browser is allowing JavaScript on localhost.
PhpMyAdmin is heavily dependent on JavaScript, and although there is a <noscript> tag in the DOM, some versions (like 4.1.2) have a CSS declaration that says:
html {
display: none;
}
It then uses JavaScript to make it visible after the page loads, for cross-framing protection. As a result, the user can't see the <noscript> section telling them to turn on JavaScript, or the rest of the page for that matter.
This issue is fairly version-specific, as it seems to have been introduced in 4.x and fixed in 4.2.12 (see related bug report). So if you come across this issue, after you enable JavaScript, try upgrading to a newer version of phpMyAdmin.
Personally my issue was with the php.ini file. After looking through the error log some of the values I put in were incorrect. By resetting them in the php.ini this allowed phpmyadmin to load properly.
The solution to this blank page problem is fairly easy. Simply modify this line in the PHPMyAdmin/config.inc.php
$cfg['Servers'][$i]['host'] = 'localhost';
to this:
$cfg['Servers'][$i]['host'] = '127.0.0.1';
In the above code, you’re changing your name server to 127.0.0.1 in order to use TCP/IP connection. After this, you should be able to see your PhpMyAdmin page by opening in your browser the address http://127.0.0.1/PhpMyAdmin
For more solutions .. >
http://www.karinamyers.com/howto-fix-phpmyadmin-displays-blank-page-after-logging-inhowto-fix-phpmyadmin-muestra-pagina-en-blanco-despues-de-logeo/
JUST change the port to 81, that worked for me . the was a conflict on port 80 with microsft.
Its simple solution change memory_limit to -1, i.e memory_limit = -1 in php.ini file and restart the wamp.
This works
Some may change the memory limit by reading what is written above it in the php.ini file.
; Maximum amount of memory a script may consume (128MB)
; http://php.net/memory-limit
memory_limit = 128M
They may change the 128M to 128MB if tinkering. It's best you enter the right credentials because the slightest mistake could have you scratching your head for hours. If you don't know.. don't change anything and seek help or best, if you don't know, you shouldn't be changing anything at all.
This has nothing to do with ports.. however, it has to do with the blank page under phpmyadmin log in and it may help someone that visits this thread.
Memory limit, post_max_size and upload_max_filesize are some of the most changed lines in an ini file and should really be separated out in a future host releases because as said above a slight change or an accidental removal of any text in there can bring your whole site crashing down.
Regarding Ports..I work with Wampserver and its a common problem that anti virus apps installed within Windows take up the same ports. Disabling these if not needed is and option but (NOT recommended). You can however change the ports that wampserver points to in your config.

Difference between ServerRoot, DocumentRoot, and Directory

While playing with Apache, I messed up the paths without making a backup httpd.config file.
The file is located at C:\xampp\apache\conf\httpd.config
I want to keep my web project on the D: drive as a virtual folder. This is the current non-working state. How can I fix this or revert to the xampp defaults?
ServerRoot "C:\xampp\apache"
DocumentRoot "D:\workspace"
<Directory "D:\workspace\AutionWebSite">
ServerRoot = path to the webserver executable/dir
DocumentRoot = path to your files that are delivered by the server
The <Directory> directive is used to configure settings for a specific directory. However, the <Directory> command in your question is not complete.
The default values for DocumentRoot and Directory for XAMPP is "C:\xampp\htdocs"
I would say that the most easiest way for you would be to check your xampp version, make a back up of your document root, which is probably "www" or "htdocs", your configuration files and eventually dump your database. Now install the same version of xammp again and there it is.
And at least the first rule is by playing with "config files", make backups before. The second rule is, make a backup of the whole configuration directory anyway, just for the case. And the last one is, if you are a xammp user, means you are a windows user, so you probably don't have unixoid server administration knowledges, so there is a long way for you to starting to "play" with the apache server.
The only think that you should know is, that you need to set the direction "AllowOverride All", which is necessary, if you use some content management system or other systems, which brings there own .htaccess file. So long you work on windows with xammp and not on a linux or other unixoid operating systems, you cannot understand the complete world of web servers like apache or database servers like postgresql and the sensibility of configuration files.
I understand the necessity of it for understanding of whole web applications respect. to be an full stack web programmer, but before that, i wouldn't change in the future the default server configurations, just check the row "AllowOverride All". Hope this will help your.
Server Root "/Local"
-specifies the default directory hierarchy for the Apache installation.
Document Root"/Local/WWW/apache22/data"
- the directory out of which you will serve your documents.