diff options
-rw-r--r-- | Makefile.am | 6 | ||||
-rw-r--r-- | src/70_mod_php.conf.in | 24 | ||||
-rw-r--r-- | src/php.eselect.in.in | 2 |
3 files changed, 30 insertions, 2 deletions
diff --git a/Makefile.am b/Makefile.am index 073abf9..9487f1b 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,6 +1,9 @@ eselectdir = $(datadir)/eselect/modules nodist_eselect_DATA = $(srcdir)/src/php.eselect +apacheconfdir = $(sysconfdir)/apache2/modules.d +nodist_apacheconf_DATA = $(srcdir)/src/70_mod_php.conf + # The next few rules allow us to replace bindir, libdir, and # localstatedir within our script and conf file. The example is taken # from the autoconf documentation and can be found in the @@ -9,7 +12,7 @@ edit = sed -e 's|@bindir[@]|$(bindir)|g' \ -e 's|@libdir[@]|$(libdir)|g' \ -e 's|@localstatedir[@]|$(localstatedir)|g' -$(nodist_eselect_DATA): Makefile +$(nodist_eselect_DATA) $(nodist_apacheconf_DATA): Makefile rm -f $@ $@.tmp srcdir=''; \ test -f ./$@.in || srcdir=$(srcdir)/; \ @@ -17,3 +20,4 @@ $(nodist_eselect_DATA): Makefile mv $@.tmp $@ $(srcdir)/src/php.eselect: $(srcdir)/src/php.eselect.in +$(srcdir)/src/70_mod_php.conf: $(srcdir)/src/70_mod_php.conf.in diff --git a/src/70_mod_php.conf.in b/src/70_mod_php.conf.in new file mode 100644 index 0000000..4b97354 --- /dev/null +++ b/src/70_mod_php.conf.in @@ -0,0 +1,24 @@ +<IfDefine PHP> + # The mod_php.so symlink is controlled by + # eselect-php. However, the module name changed from + # php5_module to php7_module so we can't blindly load whatever + # is there. Instead we let eselect-php manage a small + # configuration file that loads the appropriate module. + Include "@localstatedir@/lib/eselect-php/mod_php.conf" + + # Tell apache that mod_php should handle PHP files. + # + # NOTE: Avoiding AddHandler/AddType for security (bug + # #538822). Please read the related news item! + <FilesMatch "\.(php|php[57]|phtml)$"> + SetHandler application/x-httpd-php + </FilesMatch> + + # PHP source files which are meant to be displayed as + # syntax-highlighted source code. + <FilesMatch "\.phps$"> + SetHandler application/x-httpd-php-source + </FilesMatch> + + DirectoryIndex index.php index.phtml +</IfDefine> diff --git a/src/php.eselect.in.in b/src/php.eselect.in.in index e24cd39..689b1db 100644 --- a/src/php.eselect.in.in +++ b/src/php.eselect.in.in @@ -332,7 +332,7 @@ get_sapi_active_target() { # write_mod_php_conf() { local target="${1}" - local conf_dir="${EROOT}"/var/lib/eselect-php + local conf_dir="@localstatedir@/lib/eselect-php" local conf_path="${conf_dir}/mod_php.conf" @MKDIR_P@ "${conf_dir}" || die "failed to create ${conf_dir}" |