FAMP + Wordpress install

balanga

Son of Beastie

Reaction score: 117
Messages: 2,835

Here's a quick and dirty installation script for Wordpress running on FAMP.
(use at your own risk)

Code:
#install pkgs

cat << EOF | xargs pkg install -y
apache24
mod_php73
php73-mysqli
mysql56-server
php73-xml
php73-hash
php73-gd
php73-curl
php73-tokenizer
php73-zlib
php73-zip
EOF

#configure php

cat <<EOF >/usr/local/etc/apache24/Includes/php.conf
<IfModule dir_module>
    DirectoryIndex index.php index.html

    <FilesMatch "\.php$">
        SetHandler application/x-httpd-php
    </FilesMatch>
    <FilesMatch "\.phps$">
        SetHandler application/x-httpd-php-source
    </FilesMatch>
</IfModule>
EOF

echo '<?php phpinfo(); ?>' > /usr/local/www/apache24/data/info.php

#configure apache mysql

sysrc apache24_enable=YES
sysrc mysql_enable=YES

#service apache24 start
service mysql-server start

#install wordpress database in mysql

mysql -u root <<EOF
CREATE DATABASE wordpress;
CREATE USER wp_user@localhost IDENTIFIED BY 'wp_pass';
GRANT ALL PRIVILEGES ON wordpress.* TO wp_user@localhost;
FLUSH PRIVILEGES;
exit
EOF

#install wordpress

cd /usr/local/www/apache24/data
fetch -o - https://wordpress.org/latest.tar.gz  | tar xSf -

#configure wordpress

cd wordpress
sed -e 's/database_name_here/wordpress/' -e 's/username_here/wp_user/' -e 's/password_here/wp_pass/' wp-config-sample.php >wp-config.php
chown -R www:www /usr/local/www/apache24/data/wordpress/*

service apache24 start
Comments welcome.

I know, there's no security or checking for errors, but, it's quick and dirty :)

You can check if it has worked by:-

 
OP
OP
B

balanga

Son of Beastie

Reaction score: 117
Messages: 2,835

Thanks! I don't use Apache, can I replace with nginx?
I don't see why not, except I'm not familiar with nginx, so am not sure which paths to use. You'll need to swap nginx for apache in the pkg install list, the 'sysrc' line and the 'service start'. The paths are pertinent to apache so you would need to change them as appropriate.
 

fulano

Member

Reaction score: 11
Messages: 60

For the records: I installed WordPress with Nginx and MariaDB successfully, but was not that simple; the nginx's default installation that comes in the FreeBSD ports is very different from the Linux (which I used before), and requires some adjustments other than paths. I hope I can find some time to do a Howto soon.
 
Top