Tinycore: Wordpress 







Setting up Wordpress on Tiny Core


I wanted to add a Wordpress site to my local server where I mirror a number of web sites. These are the steps I took to get there.


My starting point was a running Apache web server setup as described here. As I write this it is running Tiny Core 8.2.1 and Apache 2.4.

This setup has persistent /home directories to hold the (potentially) large amount of fairly static data served by the websites. The /opt directory is also persistent and I place all configuration and ini files in the directory /opt/conf. This makes for easy backup of all such files.

My setup uses Apache's Virtual Server feature to deliver the multiple websites and I use the hosts file on my Windows 10 machine (from which I test) to map the shorthand names (such as 'ptowers' and 'rose') to the IP address of the TC-based server on my LAN.

Add the new website

In a similar manner to what is described here I added a new user to the server - let's call her rose. To keep in line with my development approach I also:

  • Added the home directory to the samba.conf file so that it was visible on the network.
  • Added another line to the Windows hosts file to map rose to the IP address of the web server.

Next I created a directory for the website (/home/rose/public_html) and copied a simple "it works" web page to it for an initial test.

tc@mirror:~$ mkdir /home/rose/public_html
tc@mirror:~$ cp /usr/local/apache2/htdocs/index.html /home/rose/public_html

The next step is to create an entry in the Apache virtual hosts configuration file to make the website active. I just copied over one of the existing entries with suitable adjustments.

<VirtualHost *:80>
    DocumentRoot "/home/rose/public_html"
    ServerName rb_rose
    ErrorLog "/var/log/rose-error_log"
    ScriptAlias "/cgi-bin/" "/home/rose/public_html/cgi-bin"
    <Directory /home/rose/public_html>
	Options -Indexes +FollowSymLinks
	DirectoryIndex index.php index.html
	AllowOverride All
	Require all granted

Note the AllowOverride All entry. Without this mod_rewrite will be ignored in the .htaccess file and the pretty permalinks feature of Wordpress won't work. (That had me going around in circles for a while).

Also Note - my web server is a private one. In a public facing web server there are additional security related directives you might like to add such as restricting the IP addresses that can connect to the wp-admin directory. (For example see here.)

Restart the server:

tc@mirror:~$ sudo apachectl -k restart

Point a browser at the website and check that it is there. In my case it should appear at http://rose/

Add additional software

Wordpress is written in php and stores all of its website data in a database. So we need to add these from the Tiny Core repository. What's currently there as I write this is MariaDB (a fork of MySQL) and php7-mod. The former is v10.0.17 (updated 2015/04/06) and the latter v7.2.1 (updated 2018/01/06).

Depending how you're connected to your system you can either use the App Browser, command line App Browser (tce-ab) or the tce-load command. In the example below I've used tce-load to install php7-mod.tcz.

tc@mirror:~$ tce-load -wi php7-mod.tcz
php7-mod.tcz.dep OK
libxml2.tcz.dep OK
Downloading: php7-ext.tcz
Connecting to (
php7-ext.tcz         100% |**************************************|  2528k  0:00:00 ETA
php7-ext.tcz: OK
Downloading: liblzma.tcz
Connecting to (
liblzma.tcz          100% |**************************************| 73728   0:00:00 ETA
liblzma.tcz: OK
Downloading: libxml2.tcz
Connecting to (
libxml2.tcz          100% |**************************************|   664k  0:00:00 ETA
libxml2.tcz: OK
Downloading: php7-mod.tcz
Connecting to (
php7-mod.tcz         100% |**************************************|  1904k  0:00:00 ETA
php7-mod.tcz: OK

Repeat this to install mariadb.tcz and mariadb-client.tcz.

In sorting out various problems I had along the way I also found it useful to install the command line version of php (php7-cli.tcz). With it in place the command php -i provides a wealth of information about the installation and let me track down things like misnamed directories.

We get Wordpress from the Wordpress site as a zip file and then unzip it into the document root for rose.

tc@mirror:/tmp$ wget -O
Connecting to (           100% |**************************************| 10162k  0:00:00 ETA
tc@mirror:/tmp$ su rose
rose@mirror:/tmp$ cd /home/rose/public_html/
rose@mirror:~/public_html$ unzip /tmp/

This unzips into a directory called wordpress which adds an unnecessary directory to the path. I suggest you move things up one level:

rose@mirror:~/public_html$ mv wordpress/* .
rose@mirror:~/public_html$ rmdir wordpress

PHP Configuration

php uses a .ini file which needs to be in place. I start by copying the example provided to /opt/conf where I keep all the conf/ini files.

tc@mirror:~$ cp /usr/local/etc/php7/php.ini-sample /opt/conf

Next we need to make sure that PHP can find it. I use the simple approach of placing a symbolic link to it from its default location. All this needs is an added line in

ln -s /opt/conf/php.ini /usr/local/etc/php7/php.ini

I spent some time getting the configuration sorted out. Here's what I ended up doing:

One of the issues I encountered the first time I did this has been sorted out in subsequent releases of the extension, but I'll mention it here anyway. The ini file includes an entry (extension_dir=) which points to where all the extensions are held. The entry (around line 732) reads:

extension_dir = "/usr/local/lib/php/extensions/no-debug-zts-20170718"

In an earlier release of php7-mod.tcz the date part of the file name hadn't been updated to match the actual location of the extension directory. Check and correct if necessary.

Around line 943 you should uncomment the lines so that the required mysqli extension is loaded. Some test programs I ran also wanted pdo_mysql so I uncommented that as well.

; requires mariadb-10.1-lib.tcz

When running on the same server PHP and MariaDB communicate via a socket rather than a TCP/IP port. I found that PHP defaulted to using one in /tmp rather than the one MariaDB was using in /var/run/mysqld/ so I set it explicitly (around line 1628):

; Default socket name for local MySQL connects.  If empty, uses the built-in
; MySQL defaults.
mysqli.default_socket = /var/run/mysqld/mysqld.sock

Also, for some test software I ran, I had to set it for pdo_mysql as well (around line 1122):

; Default socket name for local MySQL connects.  If empty, uses the built-in
; MySQL defaults.

Hopefully that's all the essential edits.

Apache Configuration

Next we need to edit the main Apache conf file to add the necessary support for php. Also one other thing that Wordpress requires is mod_rewrite. So around line 195 we need to uncomment mod_rewrite and add mod_php7:

LoadModule rewrite_module modules/
LoadModule php7_module modules/

Finally we need to add the handler for PHP scripts. This can either go in the main conf file or could be added to the entry for the website in the virtual hosts file. I took the latter approach and added into the rose entry:

AddHandler  php7-script .php

Setting up mysql (MariaDB)

As mentioned earlier, Wordpress stores all of its data in a database and we have installed MariaDB for this. It just now needs configuring. As the database will be holding potentially large amounts of data we'll add it to our persistent storage. Although in this instance it is being used by a single website it could actually be being used by several websites, so let's put the database in /opt/mysql rather than in a user's directory.

Create the directory:

tc@mirror:~$ mkdir /opt/mysql

Next we copy the data directory from the (read-only) extension to our persistent storage. (The -L in the cp command ensures we copy the symbolic link targets rather than the symbolic links themselves).

tc@mirror:~$ cp -Lr /usr/local/mysql/data /opt/mysql/

If we look at what we've copied over we find a number of (largish) log files. Left alone they occupy about 100MB. We'll delete them now and later configure the system so that the files are a lot smaller.

tc@mirror:~$ cd /opt/mysql/data
tc@mirror:/opt/mysql/data$ ls -l
total 110624
-rw-r-----    1 tc       staff        16384 Dec 18 13:49 aria_log.00000001
-rw-r-----    1 tc       staff           52 Dec 18 13:49 aria_log_control
-rw-r-----    1 tc       staff     50331648 Dec 18 13:49 ib_logfile0
-rw-r-----    1 tc       staff     50331648 Dec 18 13:49 ib_logfile1
-rw-r-----    1 tc       staff     12582912 Dec 18 13:49 ibdata1
drwx------    2 tc       staff         4096 Dec 18 13:49 mysql/
drwx------    2 tc       staff         4096 Dec 18 13:49 performance_schema/
drwxr-xr-x    2 tc       staff         4096 Dec 18 13:49 test/
tc@mirror:/opt/mysql/data$ rm -rf /opt/mysql/data/ib*

Copy the config file to /opt/conf where we're keeping our specific configuration files:

tc@mirror:~$ cp /usr/local/share/mariadb/my.cnf /opt/conf/

Edit the my.cnf file to reduce the log file size down to 5MB. (Uncomment line 72)

Finally add the following to to set up the correct paths, and then start the database daemon:

# Setup and start MariaDB (mysql)

rm -rf /usr/local/mysql/data
ln -s /opt/mysql/data /usr/local/mysql/data
ln -sf /opt/conf/my.cnf /usr/local/share/mariadb/my.cnf
sudo -u tc /usr/local/mysql/bin/mysqld_safe 2>&1 > /dev/null &

One final thing. Later I found, when trying to get Wordpress to work, I was getting a lot of "PHP Startup: Unable to load dynamic library...." messages in Apache's log file. This was because the mysql library had not been loaded. We have to explicitly get it loaded by adding an entry to the file /etc/

In keeping with my approach to configuration files I copied the file to /opt/conf and added the line: /usr/local/mysql/lib to it. I also added another three lines to

rm -f /etc/
ln -s /opt/conf/ /etc/


The last line is necessary as it looks like ldconfig has already been run by the time that is run so we have to run it again.

At this stage reboot and then use ps to confirm that everything that should be running is running. If you've been following this guide to the letter you should see:

  • dropbear (for remote access)
  • nmbd/smbd - samba (for shared networked drives)
  • httpd (apache web server)
  • mysqld (database)


Finally we're just about there. The final step is to create a mysql database and user. In the example below I've created a database called rose_db with a user rose with a password of rose_pwd

tc@mirror:~$ mysql -u root
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 2
Server version: 10.0.17-MariaDB Source distribution

Copyright (c) 2000, 2015, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [(none)]> CREATE DATABASE rose_db;
Query OK, 1 row affected (0.02 sec)

MariaDB [(none)]> GRANT ALL PRIVILEGES ON rose_db.* TO "rose"@"localhost" IDENTIFIED BY "rose_pwd";
Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

MariaDB [(none)]> exit

Hopefully all is as it should be.

Fire up your browser and point it at: http://rose/readme.html should bring up the readme file and show the browser is working.

Next point the browser at http://rose/wp-admin/install.php to get the example website up.

NB: At this point you'll either have to give group write permissions to the public_html directory or manually create the wp-config.php file with the suggested contents.


Any comments? email me. Added January 2018    Last update October 2018