Lien : https://linuxhint.com/install-apache-php-mysql-on-freebsd/
root@station66:~ # pkg install -y apache24
...
New packages to be INSTALLED:
apache24: 2.4.48
...
root@station66:~ # sudo sysrc apache24_enable=yes
apache24_enable: -> yes
root@station66:~ # service apache24 start
...
Starting apache24.
...
root@station66:~ # service apache24 status
apache24 is running as pid 69214.
root@station66:~ # pkg install -y mysql80-client mysql80-server
...
mysql80-client: 8.0.25_1
mysql80-server: 8.0.25_1
...
root@station66:~ # mysql --version
mysql Ver 8.0.25 for FreeBSD13.0 on amd64 (Source distribution)
root@station66:~ # sysrc mysql_enable=yes
mysql_enable: -> yes
root@station66:~ # service mysql-server start
Starting mysql.
root@station66:~ # service mysql-server status
mysql is running as pid 70587.
root@station66:~ # mysql_secure_installation
root@station66:~ # pkg install -y php74 php74-mysqli mod_php74
root@station66:~ # php --version
PHP 7.4.22 (cli) (built: Aug 1 2021 01:13:47) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
root@station66:~ # cp /usr/local/etc/php.ini-production /usr/local/etc/php.ini
root@station66:~ # sysrc php_fpm_enable=yes
php_fpm_enable: -> yes
root@station66:~ # service php-fpm start
Performing sanity check on php-fpm configuration:
[05-Aug-2021 20:18:49] NOTICE: configuration file /usr/local/etc/php-fpm.conf test is successful
Starting php_fpm.
root@station66:~ # service php-fpm status
php_fpm is running as pid 70669.
Ouvrir :
/usr/local/etc/apache24/modules.d/001_mod-php.conf
Ajouter :
<IfModule dir_module>
DirectoryIndex index.php index.html
<FilesMatch "\.php$">
SetHandler application/x-httpd-php
</FilesMatch>
<FilesMatch "\.phps$">
SetHandler application/x-httpd-php-source
</FilesMatch>
</IfModule>
root@station66:~ # apachectl configtest
Performing sanity check on apache24 configuration:
AH00557: httpd: apr_sockaddr_info_get() failed for station66.local
AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1. Set the 'ServerName' directive globally to suppress this message
Syntax OK
root@station66:~ # apachectl restart
Performing sanity check on apache24 configuration:
AH00557: httpd: apr_sockaddr_info_get() failed for station66.local
AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1. Set the 'ServerName' directive globally to suppress this message
Syntax OK
Stopping apache24.
Waiting for PIDS: 69214.
Performing sanity check on apache24 configuration:
AH00557: httpd: apr_sockaddr_info_get() failed for station66.local
AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1. Set the 'ServerName' directive globally to suppress this message
Syntax OK
Starting apache24.
AH00557: httpd: apr_sockaddr_info_get() failed for station66.local
AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1. Set the 'ServerName' directive globally to suppress this message
Ouvrir :
/usr/local/www/apache24/data/info.php
Ajouter :
<?php phpinfo(); ?>
$ links 127.0.0.1/info.php