• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

mod_php56(71) don't install or delete normaly

verbkinm

New Member


Messages: 13

#1
Hello all!
Code:
uname -a:
FreeBSD gateway-bsd 11.1-RELEASE-p4 FreeBSD 11.1-RELEASE-p4 #0: Tue Nov 14 06:12:40 UTC 2017     root@amd64-builder.daemonology.net:/usr/obj/usr/src/sys/GENERIC  amd64
I'm trying to install package mod_php56 or 71. I run the command
Code:
pkg install -y mod_php56
New packages to be INSTALLED:
        mod_php56: 5.6.32

Number of packages to be installed: 1

The process will require 4 MiB more space.
[1/1] Installing mod_php56-5.6.32...
[1/1] Extracting mod_php56-5.6.32: 100%
and the process does't end. in process table I see:
perl -w /usr/local/sbin/apxs -e -a -n php5 libphp5.so
when I kill him:
Code:
Message from mod_php56-5.6.32:
***************************************************************

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>

***************************************************************
When I run pkg delete mod_php56, everything is the same.
In modules folder I see
Code:
-rw-r--r--  1 root  wheel   4,4M  7 дек.  06:12 /usr/local/libexec/apache24/libphp5.so
But when I try to open a php page, browser downloads the file. The php module does not work.
Please Help!!!
 
Last edited by a moderator:

verbkinm

New Member


Messages: 13

#2
Code:
pkg info | grep php
mod_php56-5.6.32               PHP Scripting Language
php56-5.6.32                   PHP Scripting Language
php56-bz2-5.6.32               The bz2 shared extension for php
php56-ctype-5.6.32             The ctype shared extension for php
php56-dom-5.6.32               The dom shared extension for php
php56-extensions-1.0           "meta-port" to install PHP extensions
php56-filter-5.6.32            The filter shared extension for php
php56-gd-5.6.32                The gd shared extension for php
php56-hash-5.6.32              The hash shared extension for php
php56-iconv-5.6.32             The iconv shared extension for php
php56-json-5.6.32              The json shared extension for php
php56-mbstring-5.6.32          The mbstring shared extension for php
php56-mysqli-5.6.32            The mysqli shared extension for php
php56-opcache-5.6.32           The opcache shared extension for php
php56-openssl-5.6.32           The openssl shared extension for php
php56-pdo-5.6.32               The pdo shared extension for php
php56-pdo_sqlite-5.6.32        The pdo_sqlite shared extension for php
php56-phar-5.6.32              The phar shared extension for php
php56-posix-5.6.32             The posix shared extension for php
php56-session-5.6.32           The session shared extension for php
php56-simplexml-5.6.32         The simplexml shared extension for php
php56-sqlite3-5.6.32           The sqlite3 shared extension for php
php56-tokenizer-5.6.32         The tokenizer shared extension for php
php56-xml-5.6.32               The xml shared extension for php
php56-xmlreader-5.6.32         The xmlreader shared extension for php
php56-xmlwriter-5.6.32         The xmlwriter shared extension for php
php56-zip-5.6.32               The zip shared extension for php
php56-zlib-5.6.32              The zlib shared extension for php
phpMyAdmin-4.7.4_1             Set of PHP-scripts to manage MySQL over the web
 
Last edited by a moderator:

verbkinm

New Member


Messages: 13

#3
Code:
apachectl -v
Server version: Apache/2.4.29 (FreeBSD)
Server built:   unknown
 
Last edited by a moderator:

Snurg

Aspiring Daemon

Thanks: 252
Messages: 705

#4
In the apache httpd.conf one of the first things are the inclusions of the modules to load.
Without this, it won't load the php module.
I'd suggest you to read this to learn how to do the configuration.
 

ShelLuser

Daemon

Thanks: 806
Messages: 2,014

#7
I'm not too sure I understand the problem.

Anyway, there are 2 things which need to be done here. First you need to load the module, but then you'll also going to need to tell Apache about the new .php file format and how it should handle that.

I usually make a file called php5.conf in /usr/local/etc/apache24/Includes as follows:

Code:
<IfModule mod_php5.c>
        DirectoryIndex index.php
        AddType application/x-httpd-php .php
        AddType application/x-httpd-php-source .phps
</IfModule>
Then things should work normally.
 

SirDice

Administrator
Staff member
Administrator
Moderator

Thanks: 5,508
Messages: 25,689

#9
I usually make a file called php5.conf in /usr/local/etc/apache24/Includes as follows:
Actually, this is what the /usr/local/etc/apache24/modules.d/ directory is for.

Create /usr/local/etc/apache24/modules.d/001_php5.conf:
Code:
LoadModule php5_module libexec/apache24/libphp5.so
<IfModule mod_php5.c>
  <FilesMatch "\.php$">
    SetHandler application/x-httpd-php
  </FilesMatch>
  <FilesMatch "\.phps$">
    SetHandler application/x-httpd-php-source
  </FilesMatch>
</IfModule>
I really wished they would stop modifying httpd.conf when installing those packages and started using the modules.d directory.
 

ShelLuser

Daemon

Thanks: 806
Messages: 2,014

#10
Actually, this is what the /usr/local/etc/apache24/modules.d/ directory is for.
I'm aware, but my problem with that is that it's already filled with other configuration files. For me the problem with adding something of your own is that it'll become harder to determine if you placed the config file there yourself or if it was installed by a package. So I keep my own stuff separated in Includes.
 

SirDice

Administrator
Staff member
Administrator
Moderator

Thanks: 5,508
Messages: 25,689

#11
I'm aware, but my problem with that is that it's already filled with other configuration files.
That's the extra directory, the modules.d directory is empty as nobody seems to use it.

So I keep my own stuff separated in Includes.
I do too but only the sites themselves, split up per virtual host. Modules and module settings I put in the modules.d directory. That way you can neatly separate function and data. I'm doing it this way as it's also easy to manage with Puppet for example.