input license here

[Directadmin] instructions to install phalcon PHP from source



Introducing Phalcon php



  • Phalcon is an open source php framework, written in C-extension, optimized for perfommance. It is self-contained, allowing you to use their components customized to the application you need.

  • Phalcon is not only about performance but it is also powerful, rich in features and easy to use.


Instructions for installing Phalcon on Directadmin


By default custombuid directadmin supports installing Phalcon but only supports phalcon version 4. So BKNS guide you to install Phalcon on Directadmin according to custombuild and compile from source for low version.


Currently Phalcon version is 4.0.4, this extension only support on PHP 7+, low PHP version is not supported


1: Instructions to install Phalcon from custombuild directadmin


To install on directadmin you ssh into the server as root then run the following command.


By default custombuid directadmin supports installing Phalcon but only supports phalcon version 4



cd /usr/local/directadmin/custombuild/
./build update
./build set_php phalcon yes
./build php_phalcon

2: Instructions to compile from source (install phalcon version 3.x)


In the case of switching from Phalcon 3 to a server running Phalcon 4, you may get an error:


Uncaught BadMethodCallException: Wrong number of parameters in public_html/public/index.php:31 Stack trace:


There are 2 ways to fix updating the code according to the new version, this method takes time, so BKNS instructs us to install Phalcon version 3 to fix it.


Please follow the instructions below


Get phpize path


[root@vps build]# whereis phpize
phpize: /usr/local/bin/phpize

php-config executable Path


[root@vps build]# whereis php-config
php-config: /usr/local/bin/php-config

Download Phalcon


yum install pcre-devel gcc make git

git clone https://github.com/phalcon/cphalcon
cd cphalcon/build
git checkout origin/3.4.x
./install --phpize /usr/local/bin/phpize --php-config /usr/local/bin/php-config --arch 64bits

In the above settings, you change the parameters phpize, php-config according to the parameters above, arch version OS,


After the installation is complete, a message like the following image will appear.



Add extension to php.ini


You run the following command to get the location of the php config file (this path is for the default php on the server in case you use multiple versions of php, you need to choose the correct file location)


[root@vps build]# php --ini
Configuration File (php.ini) Path: /usr/local/php73/lib
Loaded Configuration File: /usr/local/php73/lib/php.ini
Scan for additional .ini files in: /usr/local/php73/lib/php.conf.d
Additional .ini files parsed: /usr/local/php73/lib/php.conf.d/10-custom.ini,

BKNS creates an additional file /usr/local/php73/lib/php.conf.d/10-custom.ini to avoid being overwritten.


echo "extension=phalcon.so" > /usr/local/php73/lib/php.conf.d/10-custom.ini

Once done, restart the webserver.


3. Check the results


After restarting the webserver, check that Phalcon has been installed in the following way:


php -i | grep -i phalcon 

lookup results:


phalcon
phalcon => enabled
Author => Phalcon Team and contributors
phalcon.db.escape_identifiers => On => On
phalcon.db.force_casting => Off => Off
phalcon.orm.cast_on_hydrate => Off => Off
phalcon.orm.column_renaming => On => On
phalcon.orm.disable_assign_setters => Off => Off
phalcon.orm.enable_implicit_joins => On => On
phalcon.orm.enable_literals => On => On
phalcon.orm.events => On => On
phalcon.orm.exception_on_failed_save => Off => Off
phalcon.orm.ignore_unknown_columns => Off => Off
phalcon.orm.late_state_binding => Off => Off
phalcon.orm.not_null_validations => On => On
phalcon.orm.update_snapshot_on_save => On => On
phalcon.orm.virtual_foreign_keys => On => On

Check Phalcon version


php -r "echo PhalconVersion::get();"    
3.4.5

According to the results on Phalcon BKNS is installed at 3.4.5


Good luck.


Related Posts
Diệp Quân
Nguyen Manh Cuong is the author and founder of the vmwareplayerfree blog. With over 14 years of experience in Online Marketing, he now runs a number of successful websites, and occasionally shares his experience & knowledge on this blog.
SHARE

Related Posts

Subscribe to get free updates

إرسال تعليق

Sticky