cannot get localhost working

Hi, after upgrading to Catalina yesterday, I can no longer connect to local host.


i use safari, I also use mamp and have been trying to finish my website. i've followed a few bits I found online such as....


https://coolestguidesontheplanet.com/get-apache-mysql-php-and-phpmyadmin-working-on-macos-sierra/


but it's still not working

in terminal when I run config test it brings up the following...


AH00526: Syntax error on line 244 of /private/etc/apache2/httpd.conf:


Invalid command '192.***.1.70.#', perhaps misspelled or defined by a module not included in the server configuration



Can anyone please help me




MacBook Pro 15", macOS 10.15

Posted on Jan 9, 2020 4:32 AM

Reply

Similar questions

38 replies

Jan 13, 2020 9:29 AM in response to mattp1981

Hi, I have removed the .en on the end of this file in finder....


mkdir ~/Sites

echo "<html><body><h1>My site works</h1></body></html>" > ~/Sites/index.html.en


i've also cleared my history and restarted the apache server and now i get 'My site works' - i'll follow through with the rest of the stuff and keep you posted. Presumably the web site that I am building - I simply move the folder across into this new Sites folder?

Jan 9, 2020 7:55 AM in response to mattp1981

mattp1981 wrote:

Hi, after upgrading to Catalina yesterday, I can no longer connect to local host.

i use safari, I also use mamp and have been trying to finish my website. i've followed a few bits I found online such as....

https://coolestguidesontheplanet.com/get-apache-mysql-php-and-phpmyadmin-working-on-macos-sierra/

but it's still not working
in terminal when I run config test it brings up the following...

AH00526: Syntax error on line 244 of /private/etc/apache2/httpd.conf:

Invalid command '192.***.1.70.#', perhaps misspelled or defined by a module not included in the server configuration


Can anyone please help me


It is recommended your local host not be stored in the MAMP folder itself—any upgrade of the application would loose the local host.


If you are using MAMP— I do not remember this requiring the Terminal (?)


The set up is through MAMP>Preferences and setting the path to your localhost


Are the servers up and running?


Jan 11, 2020 11:08 AM in response to mattp1981

mattp1981 wrote:

So following your guide, i've got as far as running the apachectl configtest and I am getting the below message

apachectl configtest

AH00526: Syntax error on line 244 of /private/etc/apache2/httpd.conf:
DocumentRoot '/usr/Users/mattp/Documents/Website' is not a directory, or is not readable

That doesn't look anything like my guide. /usr/Users is not a valid path.


I've now tried to go back in time by amending everything I changed whilst following this guide
https://tech-cookbook.com/2019/10/07/setting-up-your-local-server-on-macos-catalina-2019-mamp/

and then I just check everything from your guide again and now on config test I get...

You can't mix and match these things without understanding how it works to begin with. If you want assistance with some random guide on the internet, you'll have to contact the author. My guide assumes you are starting with an unadulterated version of the config files. Otherwise, all the line numbers will be wrong and the file could be invalid before you even start, which appears to be the case. You can delete the files you have modified and then re-run the Catalina installer to get back to a factor setup.

Jan 9, 2020 10:27 AM in response to mattp1981

mattp1981 wrote:

it looks very similar to some of the other things I have found online to be honest

I’ve seen similar things on the internet too. Sometimes, they are even correct! But I build my guides with a fresh install of the OS in a VM with no extras.


It looks like you have the same file open in two different vi editors. You’ll need to quit them both. If you have somehow killed one of your vi instances without closing the file, you’ll need to delete your “.swp” file.


mamp (and similar) is a self-contained installation of Apache will all of the goodies you could possibly need. It is good because it has all the goodies you will ever need. It is bad because you may not have all of those goodies when you go to install for production. Since you aren’t learning how it all works underneath, you don’t even know the different between mamp and Apache. When something goes wrong, or you update the system, you’re lost. Homebrew will do the same thing.


When you update the operating system, this can interfere with things like mamp and Homebrew. They are deeply tied to a particular version of the OS and they don’t like it when you change that from underneath them. If they have modified any system files in /etc, then the operating system may not update them and then your config files may be out of date with the new software that the OS had installed. In Catalina, can find the conflicts on your desktop in a “Relocated Items” folder. (I think that is the name).

Jan 9, 2020 8:27 AM in response to leroydouglas

Hi, the server was up and running, but i've been following this to try and resolve


https://getgrav.org/blog/macos-catalina-apache-multiple-php-versions


now in mamp I get an error saying apache couldn't be started.


I was using the terminal as I was checking apache. On my settings on mamp, they are still set to users/mattp/documents/website which is where the website bits are. I can't seem to change mamp to point to localhost though - I can only choose options on my drive

Jan 9, 2020 8:41 AM in response to mattp1981

mattp1981 wrote:

Hi, the server was up and running, but i've been following this to try and resolve

https://getgrav.org/blog/macos-catalina-apache-multiple-php-versions

now in mamp I get an error saying apache couldn't be started.

I was using the terminal as I was checking apache. On my settings on mamp, they are still set to users/mattp/documents/website which is where the website bits are. I can't seem to change mamp to point to localhost though - I can only choose options on my drive


It seems you are being funneled in a different direction...


As my parting shot I will add—MAMP does not require that Homebrew Installation from your link above.

Jan 9, 2020 9:58 AM in response to etresoft

Hi, ok, just trying to follow the guide, but now I have issues as i've amended stuff already....


sudo vi /etc/apache2/httpd.conf




E325: ATTENTION


Found a swap file by the name "/etc/apache2/.httpd.conf.swp"


          owned by: root   dated: Thu Jan  9 08:37:01 2020


         file name: /private/etc/apache2/httpd.conf


          modified: YES


         user name: root   host name: Matts-MBP-2


        process ID: 16171


While opening file "/etc/apache2/httpd.conf"


             dated: Thu Jan  9 16:00:47 2020


      NEWER than swap file!




[O]pen Read-Only, (E)dit anyway, (R)ecover, (D)elete it, (Q)uit, (A)bort: 


    be careful not to end up with two different instances of the same


    file when making changes.  Quit, or continue with caution.


(2) An edit session for this file crashed.


    If this is the case, use ":recover" or "vim -r /etc/apache2/httpd.conf"


    to recover the changes (see ":help recovery").


    If you did this already, delete the swap file "/etc/apache2/.httpd.conf.swp"




    to avoid this message.




Swap file "/etc/apache2/.httpd.conf.swp" already exists!


Swap file "/etc/apache2/.httpd.conf.swp" already exists! (Q)uit, (A)bort: 


-- More --

Jan 9, 2020 10:53 AM in response to etresoft

Hi, i'm working through this, but I can't save this bit

That file may not exist and if you upgrade from an older version, you may still not have it. It does appear to be created when you create a new user. If that file doesn't exist, you will need to create it with:

sudo vi /etc/apache2/users/<your short user name>.conf


Use the following as the content:

<Directory "/Users/<your short user name>/Sites/">

AddLanguage en .en

AddHandler perl-script .pl

PerlHandler ModPerl::Registry

Options Indexes MultiViews FollowSymLinks ExecCGI

AllowOverride None

Require host localhost

</Directory>


i'm typing code before in terminal to use visual studio code as i'm not sure how to do things in terminal, but when i go to save it says ..


Failed to save 'mattp.conf': Unable to write file (NoPermissions (FileSystemError): Error: EACCES: permission denied, open '/etc/apache2/users/mattp.conf')

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

cannot get localhost working

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.