To install Zephir, please follow these steps:
To build a PHP extension and use Zephir you need the following requirements:
- Zephir parser >= 1.1.0
- A C compiler such as gcc >= 4.4 or an alternative such as clang >= 3.0, Visual C++ >= 11 or Intel C++. It is recommended to use
gcc4.4 or later
- re2c 0.13.6 or later
- PHP development headers and tools
For Linux based systems you’ll need also:
- GNU make 3.81 or later
- autoconf 2.31 or later
- automake 1.14 or later
build-essentialpackage when using
gccon Ubuntu (and likely in other distributions as well)
If you’re using Ubuntu, you can install the required packages this way:
sudo apt-get update sudo apt-get install git gcc make re2c php php-json php-dev libpcre3-dev build-essential
Please note that specific versions of libraries and programs at the time of reading this guide may vary.
Since Zephir is written in PHP, you need to have a recent version of PHP installed, and it must be available in your console:
php -v PHP 7.0.8 (cli) (built: Jun 26 2016 00:59:31) ( NTS ) Copyright (c) 1997-2016 The PHP Group Zend Engine v3.0.0, Copyright (c) 1998-2016 Zend Technologies with Zend OPcache v7.0.8, Copyright (c) 1999-2016, by Zend Technologies
Also, make sure you have the PHP development libraries installed along with your PHP installation:
phpize -v Configuring for: PHP Api Version: 20151012 Zend Module Api No: 20151012 Zend Extension Api No: 320151012
You don’t have to necessarily see the exact above output, but it’s important that these commands are available to start developing with Zephir.
First make sure that the Zephir parser extension is installed and activated. You can follow this tutorial.
The Zephir compiler currently must be cloned from Github:
git clone https://github.com/phalcon/zephir
Run the Zephir installer:
cd zephir ./install -c
The last thing you need is to make sure you have all the necessary dependencies and install additional PHP libraries:
This step is optional for version 0.10.x, however, it will become mandatory in future versions.
Testing the Installation
Check if Zephir is available from any directory by executing: