Update: I updated the blogpost for PHP 7 instead of PHP 5. If you want to update your current PHP 5 installation to a PHP 7 installation, see this blogpost: Migrating/updating from PHP 5 to PHP 7 on OS X (MacPorts).
MacPorts is a BSD ports like package management system for OS X.
MariaDB and node.js on Mac OSX. Install moodle using Mariadb. Can't brew install MariaDB 5.5 on Mac OS. Mariadb server: I can't stop the server with `mysql. Answer (1 of 19): I use MySQL GUI clients mostly for SQL programming, and I often keep SQL in files. My current favorites are: DBVisualizer Not. Back in 2016, we blogged about deploying MariaDB 10.1.16 on Mac OS X with Homebrew. Homebrew now includes MariaDB 10.4, 10.3, 10.2, and 10.1 for macOS. We’ve refreshed this blog to reflect the latest technology. If you need the old blog, you can find it here. Run xcode-select -install. Install Homebrew.
The MacPorts Project is an open-source community initiative to design an easy-to-use system for compiling, installing, and upgrading either command-line, X11 or Aqua based open-source software on the OS X operating system.
The tool is very handy when it comes to installing command line tools for Mac. In this guide I will use it to install Apache, MariaDB and PHP. You could also install them using Homebrew, or use the packages that come with your Mac, but I prefer MacPorts… So if you don’t have MacPorts installed, follow the installation instruction on their website.
Before installing any ports, make sure you have the latest version of the ports tree:
If you have web sharing enabled on your Mac, you should disable it before continuing. Web sharing can be found under ‘System preferences’, ‘Sharing’, …
Time to install Apache:
Whenever your installation is completed, you can edit Apache’s configuration file:
/opt/local/apache2/conf/httpd.conf. Probably you want to set
DocumentRoot to your local
Sites folder. To do this change
/opt/local/apache2/htdocs to your local sites folder e.g.
You must also allow traffic to go to your webserver otherwise you will get “Permission denied” errors. By default you have a block like this in your Apache config:
Replace it with the following directive:
Don’t forget to verify your changes after every modification you do to
When everything is configured, you can start Apache using MacPorts services:
Stopping services can be done using the
Apache should be functioning right now, more configuration details can be found everywhere on the internet, I’m not gonna explain the whole config file here…
Mariadb Osx 10
Again, we use MacPorts:
Once MariaDB is installed, we need to create the main databases:
Time to start MariaDB:
Next we need to create a password for the root user, don’t forget to do this step! This procedure will interactively ask you some security details:
If you work a lot with sockets for MySQL/MariaDB, you can create a symbolic link from the default socket path to MacPort’s path:
You can also specify the socket path in your PHP config file: see below…
Note: MacPorts MariaDB has
skip-networking enabled by default in
/opt/local/etc/mariadb/macports-default.cnf. If you want to use 188.8.131.52 for your MySQL connections, you should comment out that line.
Build Mariadb Osx
If you want to use
mysql on the command line, you can link mysql to MariaDB:
Last step is installing PHP:
You might also need the following PHP extensions:
Set up your PHP configuration files. For development purposes use:
For production use:
Enable the PHP module in Apache
Brew Install Mariadb Osx
in Apache’s config file
/opt/local/apache2/conf/httpd.conf, add index.php to the
Make sure that Apache includes the PHP config, check your
httpd.conf file for the following lines:
Mariadb Osx Vs
Also verify that the
.so shared object for PHP is included:
Before we can use MySQL in our PHP code, we must set the default socket path in
/opt/local/etc/php70/php.ini. Search for
pdo_mysql.default_socket and assign the MariaDB socket to them:
If you regularly use PHP from the command line, you also want to link the
php command to the MacPorts PHP version:
Mariadb Osx Free
If you want to have colored PHP CLI output, you must enable it by installing php posix.
Verify your Apache config, restart Apache, restart MariaDB and everything should work correctly!