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.

This post assumes you are using XAMPP but it could probably work well for any PHP-based webserver.

Getting Phalcon up and running under XAMPP is relatively straightforward. To do this we need to download and install the Phalcon PHP extension dll file. Remember the thing that gives phalcon it's lightning speed is that large parts of the complexity have been bundled up into this extension. Code running under an extension runs much faster than it would run if written in PHP as it does not have to be put through the PHP interpreter on a line by line basis. If you have been using PHP for a while it's likely you have already benefited from functionality deployed in this way. Mysql, Curl and PDO are all implemented as extensions to Apache.

When downloading the Phalcon extension you need to know the version of PHP you are running and whether it is thread-safe or not thread-safe (nts).To discover this information look at the phpinfo page which is generally accessible from your XAMPP (http://localhost) homepage. For older versions of xampp you make have to execute the phpinfo(); command from within a PHP script to get this information.

From this page look first for the PHP Version in the top left hand corner of the page. Next look for "PHP Extension Build" about 15 lines down the page. This setting is a version number ending in VCXX where XX is a version number (mine is 14). Note this also. Close by (about 2 lines further down) look for a setting called "Thread Safety". This will be set to enable or disable. If it's disabled you will need the nts (non thread safe) version of Phalcon.

You can now proceed to the Phalcon php Windows dll download page on github. At the time of writing (for phalcon v3.4) this was here https://github.com/phalcon/cphalcon/releases

Download the file corresponding to your settings. I.e. if your xampp version is 7.1.8 VC15 non thread safe look for VC15nts in the file name. Note there are 2 separate builds for VC14 one for PHP V7.0 and another for PHP v7.1.

Extract the archive and copy the dll file contained in it to your php extensions folder (\xampp\php\ext). In my case the folder is in c:\xampp\php\ext.

Once this file is in place you need to change your webserver settings to look for the file on startup of the webserver.

Edit the file php.ini under (xampp\php).


Search for "extension=". Here you will find a list of PHP extensions. Some arer commented out using a semi colon.

Add the following line to the list of extensions.

extension=php_phalcon.dll

(For xampp version 7.2 and later it is no longer necessary to include .dll or the php_ at the beginning so the line will read extension=phalcon)

Save the php.ini settings file. Restart the apache webserver. Head to the phpinfo page. Search for Phalcon. You should now see a section in the phpinfo page regarding Phalcon and it's settings.

If you do not see this section and the word phalcon does not appear in the phpinfo page then the extension did not load correctly. This basically means you made some error with the version number or nts setting as I did when I first did it. Don't be discouraged try again with a different version of the file. Once you have the nts setting and VC number correct it should work.

You now have the phalcon extension installed and you're a step closer to getting your first application working!

https://youtu.be/_IcJt4ry6Nk