I'm following the excellent tutorials first here then here. I think I succeeded with most of the steps because I get the Apache "It works" when pointing the browser to http://localhost
.
I made the modifications in the files /private/etc/apache2/httpd.conf
and /private/etc/apache2/extra/httpd-vhosts.conf
as advised in the tutorials (basically telling Apache to use libphp7.so
and not to deny access to the file system).
My httpd-vhosts.conf
looks like this:
<Directory "/www">
Options Indexes MultiViews FollowSymLinks
AllowOverride All
Require all granted
</Directory>
<Virtualhost *:80>
VirtualDocumentRoot "/www/sites/%1/wwwroot"
ServerName sites.test
ServerAlias *.test
UseCanonicalName Off
</Virtualhost>
<Virtualhost *:80>
VirtualDocumentRoot "/www/sites/%-7+/wwwroot"
ServerName xip
ServerAlias *.xip.io
UseCanonicalName Off
</Virtualhost>
I have a www
directory at the top /
level:
/www
├── home
└── sites
├── client1
│ ├── assets
│ └── wwwroot
│ └── index.html
├── wordpress
When I type client1.test
in the browser address bar, it displays the content of index.html
correctly.
So the next step was to create a subdirectory wordpress
within sites
and download and unzip the latest wp version into this directory.
In the 2nd tutorial, it says "At this point you should be able to hit wordpress.test in your browser and start the WordPress installation process."
Well that doesn't work for me: I get "404 Not Found" message. My permissions look as follows:
drwxr-xrwx 5 root wheel 160 Jun 19 12:39 client1
drwxrwxrwx 23 _www wheel 736 Jun 19 15:34 wordpress
I noted that unlike the client1
subdirectory, wordpress
doesn't contain the wwwroot
subdirectory. But I guess this isn't important here? I was expecting some installation steps to begin when entering wordpress.test
.
Would anyone know possible reasons why I'm getting the 404 message? I'm on High Sierra 10.13.5.
After much digging, I found the answer.
@Devon was correct in that I should add the WordPress files (i.e., download them from the WP site, unzip them, and add them) to the subdirectory wwwroot
.
The next error was Error establishing database connection
, and apparently there is a problem with the version of mysql that I had been using. I had been using MySQL Community Server 8.0.11. But according to this post from an unrelated project, v8.0.11 of mysql has issues with php 7.1.
I completely uninstalled/deleted mysql v8.0.11 and then did brew install mysql@5.7
.
After installing v5.7, I logged in to mysql (as root user), and just ran:
mysql> create database wordpress_db;
mysql> exit
I didn't create an extra user or specify privileges; that was it. When I now open wordpress.test
in the browser, the installation script runs as expected.