Last time I described how to set up WordPress locally using Docker. This was necessary to make a playground for a few pet projects I have. One of them is setting up an online shop using WooCommerce.
I want to do this mostly just to try it out, but also to learn a thing or two about e-trade. What you need, how you set up payment channels, etc. Just in case I decide to go for it in the future. I doubt it would be too hard, since WooCommerce is one of the most advanced online shop softwares there is right now, but anyways.
Today I’ll try to install the plugin on top of the prepared WordPress installation. Perhaps creating a product listing and setting up payments is going to be too much for one day.
Let’s start.
Installing WooCommerce plugin
Once we have our WordPress running, like in the article linked above, it should be simply a matter of installing the plugin. This is usually quite easy in WordPress.
I just need to go to the Plugins section while logged in as administrator and search for WooCommerce. Then click install and done, right?
No.
I am presented with this little dialog:
WordPress FTP user? Why?
After a bit of trial and error to find the right username and password as well as a search in the Internet, I found out I need to define these username and password in a PHP file.
Alright, I know how to use containers now and I know how to tinker around with one.
But hold on, why is this StackOverflow question saying I don’t need an FTP user?
Let’s try this instead. First I’ll open a terminal within the WordPress container:
docker exec -it woocommerce bash
Here the WordPress container is named appropriately “woocommerce”.
Then let’s see what is the owner of the /var/www
directory:
root@0bb395440219:/var# ls -la total 48 drwxr-xr-x 1 root root 4096 May 2 2021 . drwxr-xr-x 1 root root 4096 Feb 13 12:57 .. drwxr-xr-x 2 root root 4096 May 2 2021 backups drwxr-xr-x 1 root root 4096 May 2 2021 cache drwxr-xr-x 1 root root 4096 May 2 2021 lib drwxr-xr-x 2 root root 4096 May 2 2021 local lrwxrwxrwx 1 root root 9 May 2 2021 lock -> /run/lock drwxr-xr-x 1 root root 4096 May 2 2021 log drwxr-xr-x 2 root root 4096 May 2 2021 mail drwxr-xr-x 2 root root 4096 May 2 2021 opt lrwxrwxrwx 1 root root 4 May 2 2021 run -> /run drwxr-xr-x 2 root root 4096 May 2 2021 spool drwxr-xr-t 2 root root 4096 May 2 2021 tmp drwxr-xr-x 1 root root 4096 May 2 2021 www root@0bb395440219:/var#
There! Right at the bottom we have it. The www
directory is owned by root
. This is all good, but let’s try to change it according to that StackOverflow question and see if it works. It says there we need to set www-data
as owner:
#chown -R www-data /var/www
And now the directory looks like this:
root@0bb395440219:/var# ls -la total 52 drwxr-xr-x 1 root root 4096 May 2 2021 . drwxr-xr-x 1 root root 4096 Feb 13 12:57 .. drwxr-xr-x 2 root root 4096 May 2 2021 backups drwxr-xr-x 1 root root 4096 May 2 2021 cache drwxr-xr-x 1 root root 4096 May 2 2021 lib drwxr-xr-x 2 root root 4096 May 2 2021 local lrwxrwxrwx 1 root root 9 May 2 2021 lock -> /run/lock drwxr-xr-x 1 root root 4096 May 2 2021 log drwxr-xr-x 2 root root 4096 May 2 2021 mail drwxr-xr-x 2 root root 4096 May 2 2021 opt lrwxrwxrwx 1 root root 4 May 2 2021 run -> /run drwxr-xr-x 2 root root 4096 May 2 2021 spool drwxr-xr-t 2 root root 4096 May 2 2021 tmp drwxr-xr-x 1 www-data root 4096 May 2 2021 www
Owner is www-data
, but group is still root
. Alright, let’s see the result!
Would you look at that!
Activating the WooCommerce plugin
Clicking the Activate button you see on the picture above leads to a wizard with 5 steps that asks for relevant information for the online-shop. You know how it goes. Enter some data click “Continue”.
Until you end up on step 4. There you have to enter details about your business but after clicking “Continue” you don’t just go to step 5, you have to choose “Free features”.
They don’t really mean a lot to me, but sure, I’ll have them all. I clicked “Continue” and I got an error that sounds something like this: “There was an error installing Jetpack. Please try installing it manually.” Same message for WooCommerce Payments.
I disabled them. No idea what they are right now, so I don’t need them, right?
Let’s make a listing!
What next?
Well, this took some time and unfortunately no listing is created. That’s not a problem, since we also can’t pay yet. So I guess these are the next steps:
- Set up payment method.
- Create a listing in WooCommerce.
- ???
- Profit
The good part is, we shouldn’t need IT skills from now on. So what are you waiting for?
Cheers!
Well, if you’re still here, why not have a look at some of my other articles: