FAMP

FreeBSD+Apache+MySQL+PHP is probably one of the most common combination of pkgs for anyone wanting to set up a website based on FreeBSD, so I think it would be useful to have a HowTo on how it should be set up...

One of the frustrating aspects of doing this is that software is constantly developing and any solution/guide is likely to be out of date within six months so I'm trying to find links showing the most uptodate guide.

Here is the latest I've found:-

https://developerslogblog.wordpress.com/2017/07/01/freebsd-11-apache-mysql-and-php-famp/
 
Well it's almost a year since I tried this and it worked then, but it doesn't work now :(...


The problem is with msql-server.... I ran
Code:
pkg install -y mysql57-server
sysrc mysql-server=YES
service mysql_enabled start

After several installation attempts I get:-
The most recent version of packages are already installed
mysql-server: server -> server
/etc/rc.conf: mysql-server=YES: not found
/etc/rc.conf: mysql-server=YES: not found
/etc/rc.conf: mysql-server=YES: not found
/etc/rc.conf: mysql-server=YES: not found
/etc/rc.conf: mysql-server=YES: not found
mysql_enabled does not exist in /etc/rc.d or the local startup
directories (/usr/local/etc/rc.d), or is not executable


The instructions seem simple enough..... what could be missing?
 
To see the variable that a given program need to have in /etc/rc.conf use rcvar. For example:

cd /usr/local/etc/rc.d
./mysql-server rcvar
# mysql # mysql_enable="NO" # (default: "")

so if you want to enable it use
sysrc mysql_enable="YES" # Your mistake here is mysql-server=YES
mysql_enable: -> YES

then you can start it using
/usr/local/etc/rc.d/mysql-server start
or
service mysql-server start
 
There is no mysql57-server in the package repository right now. pkg search mysql |grep server shows:
Code:
mysql55-server-5.5.61          Multithreaded SQL database (server)
mysql56-server-5.6.42          Multithreaded SQL database (server)
mysql80-server-8.0.12          Multithreaded SQL database (server)
 
Vull there's mysql57-server you need to update your repo.
Thanks, I double checked. It's there in 11.2-RELEASE but not in the updated repo for 12.0-RELEASE. This issue of the missing mysql57-server version has come up before on this board in recent weeks. For some technical reason it won't compile on 12.0.

Edit: ... or it might only be the i386 version that won't compile-- link: https://forums.freebsd.org/threads/mysql57-server-5-7-24-for-i386-searching.68645/
 
Here is my output for 12.0-RELEASE-p1

I see it also in http://pkg.freebsd.org/FreeBSD:12:amd64/quarterly/All/

Code:
$ pkg -vv
Version                 : 1.10.5
PKG_DBDIR = "/var/db/pkg";
PKG_CACHEDIR = "/var/cache/pkg";
PORTSDIR = "/usr/ports";
INDEXDIR = "";
INDEXFILE = "INDEX-12";
HANDLE_RC_SCRIPTS = false;
DEFAULT_ALWAYS_YES = false;
ASSUME_ALWAYS_YES = false;
REPOS_DIR [
    "/etc/pkg/",
    "/usr/local/etc/pkg/repos/",
]
PLIST_KEYWORDS_DIR = "";
SYSLOG = true;
ABI = "FreeBSD:12:amd64";
ALTABI = "freebsd:12:x86:64";
DEVELOPER_MODE = false;
VULNXML_SITE = "http://vuxml.freebsd.org/freebsd/vuln.xml.bz2";
FETCH_RETRY = 3;
PKG_PLUGINS_DIR = "/usr/local/lib/pkg/";
PKG_ENABLE_PLUGINS = true;
PLUGINS [
]
DEBUG_SCRIPTS = false;
PLUGINS_CONF_DIR = "/usr/local/etc/pkg/";
PERMISSIVE = false;
REPO_AUTOUPDATE = true;
NAMESERVER = "";
HTTP_USER_AGENT = "pkg/1.10.5";
EVENT_PIPE = "";
FETCH_TIMEOUT = 30;
UNSET_TIMESTAMP = false;
SSH_RESTRICT_DIR = "";
PKG_ENV {
}
PKG_SSH_ARGS = "";
DEBUG_LEVEL = 0;
ALIAS {
    all-depends = "query %dn-%dv";
    annotations = "info -A";
    build-depends = "info -qd";
    cinfo = "info -Cx";
    comment = "query -i \"%c\"";
    csearch = "search -Cx";
    desc = "query -i \"%e\"";
    download = "fetch";
    iinfo = "info -ix";
    isearch = "search -ix";
    prime-list = "query -e '%a = 0' '%n'";
    prime-origins = "query -e '%a = 0' '%o'";
    leaf = "query -e '%#r == 0' '%n-%v'";
    list = "info -ql";
    noauto = "query -e '%a == 0' '%n-%v'";
    options = "query -i \"%n - %Ok: %Ov\"";
    origin = "info -qo";
    provided-depends = "info -qb";
    raw = "info -R";
    required-depends = "info -qr";
    roptions = "rquery -i \"%n - %Ok: %Ov\"";
    shared-depends = "info -qB";
    show = "info -f -k";
    size = "info -sq";
}
CUDF_SOLVER = "";
SAT_SOLVER = "";
RUN_SCRIPTS = true;
CASE_SENSITIVE_MATCH = false;
LOCK_WAIT = 1;
LOCK_RETRIES = 5;
SQLITE_PROFILE = false;
WORKERS_COUNT = 0;
READ_LOCK = false;
PLIST_ACCEPT_DIRECTORIES = false;
IP_VERSION = 0;
AUTOMERGE = true;
VERSION_SOURCE = "";
CONSERVATIVE_UPGRADE = true;
PKG_CREATE_VERBOSE = false;
AUTOCLEAN = false;
DOT_FILE = "";
REPOSITORIES {
}
VALID_URL_SCHEME [
    "pkg+http",
    "pkg+https",
    "https",
    "http",
    "file",
    "ssh",
    "ftp",
    "ftps",
    "pkg+ssh",
    "pkg+ftp",
    "pkg+ftps",
]
ALLOW_BASE_SHLIBS = false;
WARN_SIZE_LIMIT = 1048576;
METALOG = "";
OSVERSION = 1200086;
IGNORE_OSVERSION = false;


Repositories:
  FreeBSD: {
    url             : "pkg+http://pkg.FreeBSD.org/FreeBSD:12:amd64/quarterly",
    enabled         : yes,
    priority        : 0,
    mirror_type     : "SRV",
    signature_type  : "FINGERPRINTS",
    fingerprints    : "/usr/share/keys/pkg"
  }
$ pkg search mysql57
mysql57-client-5.7.24_2        Multithreaded SQL database (client)
mysql57-server-5.7.24_4        Multithreaded SQL database (server)
$ freebsd-version
12.0-RELEASE-p1
 
It's not in my 12.0 repo because I'm running i386 instead of amd64.

Edit: Curiously I see it here: http://pkg.freebsd.org/FreeBSD:12:i386/quarterly/All/

But not here:
Code:
root@dell:~ # pkg update
Updating FreeBSD repository catalogue...
FreeBSD repository is up to date.
All repositories are up to date.
root@dell:~ # pkg search mysql |grep server
geoserver-mysql-plugin-2.13.2  MySQL DataStore implementation for GeoServer
mydns-mysql-1.1.0_7            DNS server designed to utilize the MySQL database
mysql-udf-0.3_3                Set of user-defined functions for the MySQL server
mysql55-server-5.5.61          Multithreaded SQL database (server)
mysql56-server-5.6.42          Multithreaded SQL database (server)
mysql80-server-8.0.12          Multithreaded SQL database (server)
mysqld_exporter-0.10.0_1       Prometheus exporter for MySQL server metrics
root@dell:~ # pkg search mysql57-server
root@dell:~ #

Probably doesn't matter anyway since most people are using amd64. Doesn't matter to me because I use PostgreSQL instead of MySQL. So as Roseanne Roseannadanna used to say, "Never mind." (-:
 
To see the variable that a given program need to have in /etc/rc.conf use rcvar. For example:

cd /usr/local/etc/rc.d
./mysql-server rcvar
# mysql # mysql_enable="NO" # (default: "")

so if you want to enable it use
sysrc mysql_enable="YES" # Your mistake here is mysql-server=YES
mysql_enable: -> YES

then you can start it using
/usr/local/etc/rc.d/mysql-server start
or
service mysql-server start

Many thanks.

Looks like I need to make my own notes since the guide I mentioned does not seem to be reliable.

This what I have to far:-
Code:
pkg install -y apache24 mysql57-server
sysrc apache24_enable=YES
sysrc mysql_enable=YES
service apache24 start
service mysql-server start

Does it look correct?
 
Back
Top