Walt Stoneburner's Ramblings

Currating Chaos

Enabling PHP on Home Directories

 •  • solved, php

In the past, I've run php and allowed it within user subdirectories, thus content in public_html can use .php files.

All was going well until I upgraded the system, then all kinds of things broke relating to home pages.

Turns out there's a new policy with PHP that disables PHP by default in user home directories. This is actually a really good idea for security reasons.

However, if a system doesn't have untrusted users, it can be okay to re-enable.

This requires going into the /etc/apache2/mods-available/php*.conf file that contains the text public_html, and commenting out the IfModule statements.

#<IfModule mod_userdir.c>
# <Directory /home/*/public_html>
# php_admin_flag engine Off
# </Directory>

Do NOT set the content within them to On, as it may be so tempting to do; for doing so will prevent .htaccess from being able to override the setting.

Hexo Tags

 •  • hexo

This one tripped me up until I saw the obvious.

Hexo posts have a tags attribute in their "frontmatter" (the meta-data at the top of a post).

Initally, I incorrectly tried putting a comma separated word list in that field.

tags: hexo, markdown, solved

This led to Hexo generating a single tag called "hexo, markdown, solved", which wasn't what I wanted.

Scouring the documentation didn't seem to flaunt any obvious answers, and even the primary example pages that Google returns don't use tags that much.

But, I did stumble across one, and the light went on. Dummy, it's YAML. That means the "frontmatter" is an array.

- hexo
- markdown
- solved

Hexo Markdown

 •  • solved, hexo, markdown

I recently started playing with Hexo and nearly gave up completely due to the markdown system provided with it.

I found strange behaviors, such as multiple adjacent lines were being treated a linebreaks instead of a paragraph, as markdown normally does.

There was a workaround, which involved changing a setting in the _config.yaml file, but that didn't fix things completely.

If a line started with a link, then there were situtations where it wouldn't wrap it in a paragraph and weird things happened. If a link came at the end of the line, it'd usually work fine, but if there was a period immediately after the tag, then it'd absorb the next paragraph.

I found with all kinds of permutations just trying to build a simple example.

Then, I read about hexo-renderer-markdown-it which was described as "Markdown down right."

I uninstalled the default version:

npm un hexo-renderer-marked --save

Installed the new one:

npm i hexo-renderer-markdown-it --save

And without changing any of my valid markdown, the page rendered perfectly.

This plugin should be the default version that ships with hexo.

Yarn Issues

 •  • solved, software

While exploring hexo, I ran into a problem installing it.

yarn was aborting the install claiming that there was no <code>--production</code> switch.

A quick check of yarn's version number showed that I was somehow way out of date.

According to yarn's installation directions this was merely a matter of performing a self-update, which yarn also claimed it wasn't able to do, or to install an updated pubkey.gpg and install/update with apt.

These solutions didn't work either.

The problem was that another package, cmdtest, had it's own obsolete copy of yarn.

The solution was simply to uninstall it, then install yarn with apt:

sudo apt remove cmdtest

curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
sudo apt-get update && sudo apt-get install yarn