FreeBSD:Apache:修订间差异
imported>Riguz 无编辑摘要 |
无编辑摘要 |
||
第9行: | 第9行: | ||
# /usr/local/www/apache24/data/ | # /usr/local/www/apache24/data/ | ||
</source> | </source> | ||
安装 php: | |||
<source lang="bash"> | |||
pkg install php72 mod_php72 php72-ctype php72-mbstring php72-json php72-iconv php72-fileinfo php72-xml php72-session php72-dom php72-hash php72-gd php72-xmlreader php72-xmlwriter php72-openssl | |||
</source> | |||
在/usr/local/etc/apache24/modules.d中新建配置文件:010_mod_php.conf,注意命名。 | |||
<pre> | |||
# Files are automatically included if the name | |||
# begins with a three digit number followed by '_' | |||
# and ending in '.conf' e.g. '080_mod_php.conf' | |||
</pre> | |||
<pre> | |||
<FilesMatch "\.php$"> | |||
SetHandler application/x-httpd-php | |||
</FilesMatch> | |||
<FilesMatch "\.phps$"> | |||
SetHandler application/x-httpd-php-source | |||
</FilesMatch> | |||
</pre> | |||
还需要在 httpd.conf中打开 mod_rewrite. | |||
[[Category:Linux/Unix]] | [[Category:Linux/Unix]] |
2018年9月6日 (四) 07:54的最新版本
pkg install apache24
sysrc apache24_enable="yes"
# /etc/rc.conf
# apache24_enable="yes"
service apache24 start
# /usr/local/www/apache24/data/
安装 php:
pkg install php72 mod_php72 php72-ctype php72-mbstring php72-json php72-iconv php72-fileinfo php72-xml php72-session php72-dom php72-hash php72-gd php72-xmlreader php72-xmlwriter php72-openssl
在/usr/local/etc/apache24/modules.d中新建配置文件:010_mod_php.conf,注意命名。
# Files are automatically included if the name # begins with a three digit number followed by '_' # and ending in '.conf' e.g. '080_mod_php.conf'
<FilesMatch "\.php$"> SetHandler application/x-httpd-php </FilesMatch> <FilesMatch "\.phps$"> SetHandler application/x-httpd-php-source </FilesMatch>
还需要在 httpd.conf中打开 mod_rewrite.