WillSquire of Upperdog
1/8/2016 - 9:10 AM

Wordpress FAMP - Wordpress application on FAMP (FreeBSD, Apache, MySQL & PHP) stack

Wordpress FAMP - Wordpress application on FAMP (FreeBSD, Apache, MySQL & PHP) stack

Wordpress FAMP setup

Prerequisites

This assumes a FAMP stack has already been installed/configured ready for Wordpress installation and configuration.

PHP

Wordpress requires the PHP modules php56-xml, php56-hash, php56-gd, php56-curl, php56-tokenizer, php56-zlib and php56-zip to be installed. It also requires the php56-mysql port, however this port should of been installed as part of the FAMP stack. To installed the required ports (tip: use whereis to find the location of a port i.e. whereis php56-xml will return php56-xml: /usr/ports/textproc/php56-xml):

cd /usr/ports/textproc/php56-xml && sudo make config-recursive install distclean
cd /usr/ports/security/php56-hash && sudo make config-recursive install distclean
cd /usr/ports/graphics/php56-gd && sudo make config-recursive install distclean
cd /usr/ports/ftp/php56-curl && sudo make config-recursive install distclean
cd /usr/ports/devel/php56-tokenizer && sudo make config-recursive install distclean
cd /usr/ports/archivers/php56-zlib && sudo make config-recursive install distclean
cd /usr/ports/archivers/php56-zip && sudo make config-recursive install distclean

OR

Use FreeBSD's PHP extensions ports to select and install all the common PHP modules (using the mouseclick to choose what gets installed) with:

cd /usr/ports/lang/php56-extensions && sudo make config-recursive install distclean

MySQL

Enter the MySQL CLI replacing [username] with the MySQL username previously setup (default is root) and enter password when prompted:

mysql -u [username] -p

Create a database for the application, replacing [application] for the application's database name:

CREATE DATABASE [application];

Create a MySQL user for the application, replacing [application_user] with the username and [application_user_password] with the password:

CREATE USER [application_user]@localhost IDENTIFIED BY '[application_user_password]';

Grant access for the new user to the new database (replacing [application] for the application's database name and [application_user] with the username used previously):

GRANT ALL PRIVILEGES ON [application].* TO [application_user]@localhost;

Flush all priveledges for this to take effect:

FLUSH PRIVILEGES;

Exit MySQL CLI:

exit

Apache

Open up the Apache config file:

sudo ee /usr/local/etc/apache24/httpd.conf

Uncomment rewrite_module module by removing the # so it looks like this:

LoadModule rewrite_module libexec/apache24/mod_rewrite.so

Next find the <Directory "/usr/local/www/apache24/data"> section, then find AllowOverride None and change None to All, like so:

AllowOverride All

Save, exit and then restart Apache with:

sudo service apache24 restart

Permissions

If an SFTP client is going to be used to interactive with files, having a user with root priveledges via the wheel user group can cause issues with the default folder permissions 755 because these do not run sudo commands. Changing the permission to grant rwx access to everyone who is in the folder's group (wheel) will prevent permissions issues from these programs:

sudo chmod -R 775 /usr/local/www/apache24/data

References