B
B
big_hasan2016-12-14 09:45:17
PHP
big_hasan, 2016-12-14 09:45:17

CentOS: how to make PHP and Apache friends and what is this php-apache package?

Vagrant, CentOS 6, PHP7
When requested, gave out a php-file with text.
changed short_open_tag to On in php.ini - did not help.
Changed in httpd.conf

<FilesMatch "^\.ht">
    Require all denied
</FilesMatch>

on the
<FilesMatch \.php$>
    SetHandler application/x-httpd-php
</FilesMatch>

- to no avail.
Somewhere I googled what needs to be registered LoadModule php7_module modules/libphp7.so. And so he did. When trying to restart, Apache swears at this very line - it says that it cannot find the /etc/httpd/modules/libphp7.so. Further googling gave such information that in some cases it helps to install a certain "php-apache" package. I got the impression that this is some kind of mythical package, because I couldn’t google information about it, yum install couldn’t set it on it, and I didn’t find anything similar in the repositories. I looked for mod_php in turnips, tried to install mod_php70u.x86_64 from the found ones - it did not help. What to do??
PS: in the console, puff normally does all sorts of garbage like echo ('Hello world'); - there are no complaints about him
UPD:
Снёс Апач, поставил заново, долго танцевал с бубном, снова появилась эта проблема. Проделал снова то, что описывал в вопросе - прописал SetHandler application/x-httpd-php, и заработало. Я так и не понял, в чем было дело.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
Дмитрий Айткулов, 2016-12-14
@Scarfase1989

look here for centos 7 but still. and in general I advise you to switch to centos 7

I
ilya-zharskiy, 2020-10-23
@ilya-zharskiy

On CentOS6 you can install php70-php-7.0.33-23.el6.remi.x86_64.rpm
https://centos.pkgs.org/6/remi-x86_64/php70-php-7....
if the turnips are still alive.
This RPM package contains mod_php - the Apache web server (httpd) module, by downloading which Apache will be able to process php scripts on its own

This package contains the module (often referred to as mod_php)
which adds support for the PHP language to system Apache HTTP Server.

The provided functionality is called
php70-mod_php
After installing the package at the address (path)
/opt/remi/php70/root/usr/lib64/httpd/modules/libphp7.so
there will be a php library (module) for apache
and along the way
/usr/lib64/httpd/modules/libphp70.so- a link to it
PS
but better:
1) switch to CentOS7
2) do not use Apache at all, but install nginx
3) use php-fpmmod_php instead

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question