HALF PRICE!
Udemy
course when you register on learnphalcon
The examples on this site are currently tested to work on Phalcon V3.4 and Phalcon Devtools V3.2 Some issues may arise when using later versions.

Please get in touch or post a comment below the post if you encounter a problem.

The php.ini settings file under Linux has the same basic function as it does under Windows. That is to control the configuration of PHP on your system.

There are some fundamental differences in relation to how the file is handled under Linux. It's stored, with all the other Linux software configuration files, in /etc.

There may be some slight variations to the folder structure depending on what flavor of Linux you are using. The php.ini file on Ubuntu is found in /etc/php/7.2/apache2/php.ini. As it is possible to have a number of different versions of PHP running on the same server at the same time, their version numbers are included in the path. The PHP extensions themselves under Linux are not loaded directly from the php.ini file itself. There are a number of reasons for this - mostly its just a sensible way of managing separate extensions separately.

In Ubuntu 18.04 the directives to load individual modules are stored in separate files in /etc/php/7.2/mods-available. To see this change directory into that folder as follows:

cd /etc/php/7.2/mods-available

To see a directory listing of these separate ini files type

ls -al

To create an ini file for Phalcon type

sudo nano phalcon.ini

Copy and paste the following lines into the file and save the file type typing CTRL-X.

; configuration for php common module
; priority=50
extension=phalcon.so
The first two lines in the file are comments. Priority=50 refers to the order in which the module should be loaded. Some modules have a dependency on other modules so if you attempt to load them before the module on which they are dependent is loaded, you get an error. This method ensures good control over the order in which modules are loaded.
To make this priority loading of modules work we need to create a symbolic link to the phalcon.ini file in the conf.d folder. On my system this is in /etc/php/7.2/apache2/conf.d.
To change directory into this folder type
cd /etc/php/7.2/apache2/conf.d
To create the symbolic link to the phalcon.ini file in the /etc/php/7.2/apache folder type
ln -s /etc/php/7.2/mods-available/phalcon.ini 50-phalcon.ini

To see the file in the mods available folder type

ls -al

This should show you something like the following directory listing

The first column indicates the permissions, the second column indicates the type of file (in this case a symbolic link). The next two columns indicate the owner and group of the file - both root. This is followed by the last time the file was updated, then the name of the file and the file it is linking to. 

Symbolic link files are empty pointers to other files. They are used extensively in Unix and are a great way of organizing folders. In this case, they are useful as they help implement the priority loading of modules in PHP. The fact that our phalcon.ini has a prefix of 50- on the symbolic link will ensure it gets loaded after modules with a lower number on their prefix.

Now that we have created the phalcon.ini and the symbolic link with priority indication we are ready to restart the apache server and see if the Phalcon module has loaded correctly.

To do this type

sudo service apache2 restart

Then visit http://your_server_ip_address/phpinfo.php. The modules and their settings are listed alphabetically on this page. To see if phalcon has loaded correctly scroll down to 'p' and you should see the following settings.

You have now successfully loaded the PhalconPHP module. Once you have completed this step it is advisable to delete the phpinfo.php page as it can expose valuable information about your system to potential hackers.