Three things.
WordPress FTP Madness
WordPress does not need you to have an FTP server. If you’ve been trying to update things and it keeps asking for your FTP server, and then you’re thinking “but I own the box it’s hosted on and that’s where my files are.. why can’t I just update? Why do I need FTP?” Then you’re just like me about 15 minutes ago. What you need to do is change the owner of your wordpress directory (and all subdirs and files) to the same as the user that your apache webserver runs as. This will probably be ‘www-data’ if you’re on Ubuntu. This problem comes up because Wordress, running in your webserver, doesn’t have the ability to write to certain directories it needs to – so it asks you for FTP access to them, which it thinks would be a reasonable way to go about it. It probably is, in some cases, but not ours!
What did I do to fix it? I went to the directory above my blog folder (so, I was inside of ‘~/public_html/’ on my server) and I ran
chown -R www-data blog
This will CHange OWNership Recursively to www-data on the directory blog (and therefore, all of its subdirs and files). You can check what user your server runs as by going to /etc/apache2/envvars — you should be able to see it exporting APACHE_RUN_USER and APACHE_RUN_GROUP, probably as www-data.
Once I’d done this, I hit refresh and wordpress worked as desired! I can now update things and not grapple with FTP questions I don’t have answers to.
WordPress Syntax Highlighting
Now that everything worked so darn well, I went to this place and installed SyntaxHighlighterPlus. There’s some annoying things about it (I don’t really want to see line numbers, and the colour scheme is hideous) but it allows me to have code that’s worlds prettier in my posts.
Be careful about googling for configuration options! There’s a different SyntaxHighlighter out there, which this is just integrating into wordpress. The syntaxes used for inserting code into your blog are very different between the two and the non-wordpress one has a lot more options available within it. I may see what I can do to extend what I’ve got, or just find something else that does the trick better.
Pretty Permalinks
I’ve been frustrated by having ‘?p=##’ style links for a while now, and tried going into Settings->Permalinks and changing my format — but whenever I did it, wordpress would give 404 for the pretty link. The old link continued to work, but wordpress would not set pretty links for some reason. A bit of googling told me that you need to have apache’s mod_rewrite enabled in order to use pretty links! So I went to /etc/apache2/mods_enabled.. and mod_rewrite wasn’t there. That’s a good sign, means that is probably the cause. But how do I enable it? Google wasn’t helpful — most recent results were from over a year ago! Everyone was telling me to go edit files and touch them and such, and I know apache has some newfangled tool for enabling modules.. what was it? More googling. a2enmod. You should use a2enmod to enable mod_rewrite.
So, sudo a2enmod mod_rewrite.
Then… it still doesn’t work! That’s because of two things. First: You have to reload Apache’s configuration settings. You may have just been told by the a2enmod command to run ‘/etc/init.d/apache2 restart’, but that’s not a great idea because it actually restarts the process, which is ugly. Instead, run ‘/etc/init.d/apache2 reload’ (remember to use sudo) and it’ll cleanly reload the config files without a restart. The second reason is bigger: you’ve got another change to make. You’ve enabled the module, but you haven’t actually given apache the directives to allow it to make changes to your site’s URLs – so let’s do that. Go to /etc/apache2/sites-enabled/ and sudo vim (or gedit, nano, whatever) the symbolic link there, that leads to your website. It should look a bit like this:
ServerAdmin carss.w@gmail.com DocumentRoot /home/wcarss/public_html <Directory /> Options FollowSymLinks AllowOverride None </Directory> <Directory /home/wcarss/public_html> Options Indexes FollowSymLinks MultiViews AllowOverride None Order allow,deny allow from all </Directory> ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/ <Directory "/usr/lib/cgi-bin"> AllowOverride None Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch Order allow,deny Allow from all </Directory>
Change the ‘AllowOverride’ directives in the first two Directory entries (the blank one and the one for your site’s document root) from ‘AllowOverride None’ to ‘AllowOverride all’. The result should be:
ServerAdmin carss.w@gmail.com DocumentRoot /home/wcarss/public_html <Directory /> Options FollowSymLinks AllowOverride all </Directory> <Directory /home/wcarss/public_html> Options Indexes FollowSymLinks MultiViews AllowOverride all Order allow,deny allow from all </Directory> ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/ <Directory "/usr/lib/cgi-bin"> AllowOverride None Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch Order allow,deny Allow from all </Directory>
That’s all there is to change. Now you’ve got to run ‘/etc/init.d/apache2 reload’ once more, and then try our pretty permalinks. Should work dandy!
Conclusion
That was a fun detour and I’ve got a prettier, more functional blog for it; but it certainly didn’t advance my 4chan scraper, get any of my 3000 paper written, advange my 1500 marker, or even get my overdue philosophy paper done. Alas, you can’t have everything at once. 🙂