0

How to access localhost on Ubuntu for Windows?

I'm on Windows 10 Pro 64-bit, version 1709, OS Build 16299.125

I've installed the Ubuntu 16.04.3 LTS Linux Sub-system locally for Web Development purposes.

I've placed an info.php file into \var\www\html but when I attempt to access it at 127.0.0.1/info.php via my Browser in Windows, I receive the error:

"This page isn’t working 127.0.0.1 is currently unable to handle this request. HTTP ERROR 500"

info.php has the following code in it:

<?php

// Show all information, defaults to INFO_ALL
phpinfo();

?>

If I access 127.0.0.1 via my browser in Windows, I receive the Apache2 Ubuntu Default Page.

And that's it. Just trying to get this working. I've installed LAMP, Composer, Platform.sh CLI and that's it on this server thus far.

Edit Found an error log in \var\www\html called

C#003A#005Cxampp-new#005Cphp#005Clogs#005Cphp_error_log

Opened it and it says:

[15-Dec-2017 10:18:41 America/New_York] PHP Warning: Unknown: failed to open stream: Permission denied in Unknown on line 0

[15-Dec-2017 10:18:41 America/New_York] PHP Fatal error: Unknown: Failed opening required '/var/www/html/info.php' (include_path='.:/usr/share/php') in Unknown on line 0

Not sure what that means. Any ideas?

Thank you.

1 Answer 1

0

Found out why this was happening. Ran:

$ sudo chmod -R 777 var

And that worked. I DO NOT RECOMMEND DOING THIS ON A PRODUCTION SYSTEM. This is a local Development System!

1
  • Check the permissions of each level of the directory tree for /var/www/html/info.php to make sure that whatever account Apache is running in has access. I was writing this comment when your answer appeared: it's unnecessarily drastic, and is definitely not recommended, as it will remove any extended attributes (SUID, etc). If you want to be so drastic, at least use ugo+rwx instead of 777 and log the changes with -v, so that you can undo them later with a bit of scripting on the log file. I doubt that you will need write access, nor to directories outside /var/html.
    – AFH
    Dec 15, 2017 at 15:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.