To get started with Phalcon, I already have my server stack setup with Ubuntu 16.04, Percona MySQL, Nginx, and PHP 7.0 FPM. If you need a refresher, you can check out my other blog post where I set this stack up for a Laravel web app.
To get started, we need to add the Phalcon repository to our system.
curl -s "https://packagecloud.io/install/repositories/phalcon/stable/script.deb.sh" | sudo bash
This script will go through and add the Phalcon keys, add the repo, and update the APT cache. After this, all we will need to do is install the PHP extension.
sudo apt-get install php7.0-phalcon
Reboot PHP FPM.
sudo systemctl php7.0-fpm restart
Now we can create a /info.php file with the contents
and check in our browser that Phalcon is indeed loaded in.
Phalcon also includes a package of tools, called the Phalcon DevTools, to aid in development. Let’s install these now.
I will be using the Git install method, but Phalcon DevTools can also be installed with Composer using the instructions on their docs page.
To get started, I will clone the repo into my home folder. You can put this repo wherever you’d like, but you cannot delete or move this folder without reinstalling the DevTools.
cd ~ git clone https://github.com/phalcon/phalcon-devtools.git cd phalcon-devtools
Now run the installer script:
sudo bash phalcon.sh
The installer will add the current dir to your path, which will enable you to use
straight from your terminal. If you are having issues, be sure to log out of your shell session and re-login to load in the new PATH environment variable.
Be sure to check back in a few days where I will go over using models in Phalcon.