MacOS – MAMP still can’t access Apache after creating local virtual hosts

apachemacosMySQLwebserver

I had finally got my PHP and MySQL to work again and then I decided to set up local virtual host. Everything was working perfectly up to that point. I have been getting error messages when I do apachectl configtest. My first error message was:

httpd:Syntax error on line 483 of /private/etc/apache2/httpd.conf Mac OS X. There was another error on a line in the /private/etc/apache2/extra/httpd-vhosts.conf as well, but I can't remember which line. I tried everything to find the errors. Then I ran across question on your forum "Can't access apache-powered website at localhost [duplicate] and followed those instructions to reinstall Apache. I did a configtest first and got:

[Thu Aug 09 05:41:07 2018] [warn] module php5_module is already loaded,    skipping
httpd: Syntax error on line 483 of /private/etc/apache2/httpd.conf: Syntax error on line 40 of /private/etc/apache2/extra/httpd-vhosts.conf: </VirtualHost> without matching <VirtualHost> section

Then I downloaded the duplicate https.conf file and got this error message:

Malindas-Mac:~ malindasmith$ apachectl configtest
httpd: Syntax error on line 71 of /private/etc/apache2/httpd.conf:        Cannot load /usr/libexec/apache2/mod_authn_core.so into server: dlopen(/usr/libexec/apache2/mod_authn_core.so, 10): image not found

I had originally created 3 virtual hosts and rearranged my files from htdocs to the local Sites folder. What am I doing wrong?

Specs:

2.26 GHz Intel Core 2 Duo
2 GB 1067 MHz DDR3
OS X 10.9.5

Configuration Files Edited

I finally got my virtual host responding:

[Sat Aug 11 11:39:50 2018] [warn] module php5_module is already loaded, skipping
WARNING: MaxClients of 150 exceeds ServerLimit value of 133 servers,
 lowering MaxClients to 133.  To increase, please see the ServerLimit
 directive.
VirtualHost configuration:
wildcard NameVirtualHosts and _default_ servers:
*:80                   is a NameVirtualHost
         default server theindieconnection (/private/etc/apache2/extra/httpd-vhosts.conf:28)
         port 80 namevhost theindieconnection (/private/etc/apache2/extra/httpd-vhosts.conf:28)
         port 80 namevhost dreamweaver.site (/private/etc/apache2/extra/httpd-vhosts.conf:43)
Syntax OK

But I was only able to view the default virtual host and the second site would access the index page from the default and I still couldn't access localhost through MAMP. Then, it stopped working again after I altered the Virtualhost files and permissions:

Malindas-Mac:conf malindasmith$ /Applications/MAMP/Library/bin/apachectl stop
httpd: Syntax error on line 62 of /Applications/MAMP/conf/apache/httpd.conf: Cannot load /Users/malindasmith/Sites/modules/mod_authn_file.so into server: dlopen(/Users/malindasmith/Sites/modules/mod_authn_file.so, 10): image not found

Then after trying to clean up my mess, I get:

httpd: Syntax error on line 62 of /Applications/MAMP/conf/apache/httpd.conf: Cannot load /Library/WebServer/Documents/modules/mod_authn_file.so into server: dlopen(/Library/WebServer/Documents/modules/mod_authn_file.so, 10): image not found

All the files that showing errors are modules pertaining to authentication. I just can't figure it out.

Best Answer

I want to first apologize for returning so late. The craziness life throws at you all at once is unbelievable at times.

Nonetheless, I had obtained a copy of a httpd.conf file that I thought was for v2.2, but it was for v2.4. That had messed me up even more. Once I received the correct copy, I replaced the original and duplicated it for backup and put everything back to the way it was. Now my php, mysql, and site folders are working perfectly together. I still cannot get to the MySQL database page and apparently the reason why is because I downloaded Bootstrap (which I don't think that altered anything because I haven't used it yet) and Atom text editor and live server. Now that took over everything! I haven't utilized it yet. I have been using TextWrangler, because I have been time crunching on a project. I'll figure out Atom later.

So, in a nutshell, I believe Atom has taken over the MySQL access page. But everything else is working fine. Also, I will have to practice a bit more on setting up virtual hosts, because that is when everything went wrong and how I got to Atom.