Unlike CentOS 7, you need to install REMI repo in order to use and install PHP7, here in FreeBSD, you don't need to add repo list to be able to install PHP7, you can now directly install PHP7 by installing the package and modules. The hardest part is installing the modules, because there are so many different PHP7 modules that are not automatically install the dependencies. So be patient in installing modules.
1. Install PHP7 and PHP7 modules. You can also install other modules in order to funciton your PHP7 very well. These modules are php70-ctype, php70-pgsql, php70-session, php70-hash, php70-iconv, php70-json, php70-mbstring, php70-pgsql, php70-pdo_pgsql and etc.
pkg install php70 php70-mcrypt php70-mysqli php70-gd php70-pdo
2. Configure PHP7. After the rehash, you can actually use the command echo 'php_fpm_enable="YES"' >> /etc/rc.conf. This command is the shortcut version of vi /etc/rc.conf and add the code php_fpm_enable="YES", this command will also allow us to enable our php on start-up, so that we don't start our php-fpm every time we are restarting our OS. After adding it to our rc.conf, we need to restart or start our php-fpm in order to take effect our changes in rc.conf. And finally, we will use the command php -version to know our version of php that we are using. And there you have it, feel free to ask questions and comments below.
rehash
vi /etc/rc.conf
php_fpm_enable="YES"
service php-fpm start
php -version
No comments:
Post a Comment