Localhost not working on XAMPP - both service apache & mysql are fine

萝らか妹 提交于 2019-12-03 21:01:00

I struggled for days figuring out why I was getting a blank screen while using xampp. The cultprit was skype. Always turn of skype when you want to use localhost.

le dorfier

In your "xampp" menu group, one of the items is "Port Checking". If I run it, I get:

***************************************************************
*                  XAMPP PortCheck v1.2                       *
*                                                             *
*     (c) 2005 Carsten Wiedmann <info@wiedmann-online.de>     *
*                                                             *
* This script uses openport.exe:                              *
* (c) 2003 DiamondCS <http://www.diamondcs.com.au/openports/> *
***************************************************************

Please wait a moment...


RESULT
------

Service              Port   Status
==============================================================================
Apache (HTTP)          80   C:\bin\xampp\apache\bin\apache.exe
Apache (WebDAV)        81   free
Apache (HTTPS)        443   C:\bin\xampp\apache\bin\apache.exe

MySQL                3306   free

FileZilla (FTP)        21   free
FileZilla (Admin)   14147   free

Mercury (SMTP)         25   free
Mercury (POP3)        110   free
Mercury (IMAP)        143   free

Press <Return> to continue.

Can you run this, and what do you get?


You can also try the following (esp. if you get Apache (HTTP) Port 80 as in my results):

First see if apache is serving your port 80. I just did this with my setup using telnet.

telnet localhost 80

You should get a blank screen. You can type but there's no echo. If you don't get this, Apache isn't operating as your localhost web server, so we need to find out why.

If it is, choose a file you know exists in your web server root directory (using "index.html" as an example, enter (you may not see what you type):

GET /index.html

Apache should just display the file contents (in raw form). See if you get this far.

  1. try your machines IP (eg 192.168.x.y)
  2. try tcp/IP-Loopback: 127.0.0.1
  3. try your computername (use ipconfig /all to retrieve your computername)
  4. ping localhost and compare the ip

Have you upgraded to PHP 5.3 on Windows recently?

If so, change 'localhost' to '127.0.0.1'. See: http://bugs.php.net/45150

Here is some code which can be used to make an installation portable:

    # Convert localhost to 127.0.0.1 on PHP 5.3.x on Windows (Vista); see http://bugs.php.net/45150
    if ($hostname == 'localhost') {
        if (substr (PHP_OS, 0, 3) == 'WIN') {
            if (version_compare (PHP_VERSION, '5.3.0', '>=')) {
                $hostname = '127.0.0.1';
            }
        }
    }
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!