# cd /usr/ports/lang/php84/ && make install clean
# cd /usr/ports/lang/php84-extensions/ && make install clean
# cd /usr/ports/www/mod_php84 && make install clean
查看 PHP 版本:
root@ykla:~ # php -v
PHP 8.4.4 (cli) (built: Feb 15 2025 01:05:08) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.4.4, Copyright (c) Zend Technologies
root@ykla:~ # pkg search -o lang/php
lang/php-mode.el PHP mode for GNU Emacs
lang/php-mode.el PHP mode for GNU Emacs
lang/php-mode.el PHP mode for GNU Emacs
lang/php-mode.el PHP mode for GNU Emacs
lang/php81 PHP Scripting Language (8.1.X branch)
lang/php81-extensions "meta-port" to install PHP extensions
lang/php82 PHP Scripting Language (8.2.X branch)
lang/php82-extensions "meta-port" to install PHP extensions
lang/php83 PHP Scripting Language (8.3.X branch)
lang/php83-extensions "meta-port" to install PHP extensions
lang/php84 PHP Scripting Language (8.4.X branch)
lang/php84-extensions "meta-port" to install PHP extensions (8.4.X branch)
root@ykla:~ # service php_fpm enable
php_fpm enabled in /etc/rc.conf
root@ykla:~ # service php_fpm start
Performing sanity check on php-fpm configuration:
[25-Feb-2025 20:28:32] NOTICE: configuration file /usr/local/etc/php-fpm.conf test is successful
Starting php_fpm.
root@ykla:~ # service php_fpm status
php_fpm is running as pid 2592.
查看安装后信息:
root@ykla:~ # pkg info -D mod_php84
mod_php84-8.4.4_1:
On install:
******************************************************************************
Consider switching to php-fpm and mod_fast_cgi as per Apache httpd project
recommendation. See https://cwiki.apache.org/confluence/display/HTTPD/PHP-FPM
******************************************************************************
If you are building PHP-based ports in poudriere(8) or Synth with ZTS enabled,
add WITH_MPM=event to /etc/make.conf to prevent build failures.
******************************************************************************
Make sure index.php is part of your DirectoryIndex.
You should add the following to your Apache configuration file:
<FilesMatch "\.php$">
SetHandler application/x-httpd-php
</FilesMatch>
<FilesMatch "\.phps$">
SetHandler application/x-httpd-php-source
</FilesMatch>
******************************************************************************
root@ykla:~ # service php_fpm restart
Performing sanity check on php-fpm configuration:
[25-Feb-2025 20:59:12] NOTICE: configuration file /usr/local/etc/php-fpm.conf test is successful
Starting php_fpm.
root@ykla:~ # service nginx restart
Performing sanity check on nginx configuration:
nginx: the configuration file /usr/local/etc/nginx/nginx.conf syntax is ok
nginx: configuration file /usr/local/etc/nginx/nginx.conf test is successful
Stopping nginx.
Waiting for PIDS: 1153.
Performing sanity check on nginx configuration:
nginx: the configuration file /usr/local/etc/nginx/nginx.conf syntax is ok
nginx: configuration file /usr/local/etc/nginx/nginx.conf test is successful
Starting nginx.