Solved Apache & php

I've seen numerous guides to getting php working with Apache and am having problems displaying

<?php phpinfo(); ?>

What is the minimum I need to install?

Is this sufficient?

sh:
cat <<EOF >/usr/local/etc/apache24/Includes/php.conf
<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>
EOF
 
cat <<EOF >/usr/local/etc/apache24/Includes/php.conf
Put it in /usr/local/etc/apache24/modules.d/001_php.conf
Not going to change how it works, but it keeps things a bit more organized. Use the Includes/ directory for your website configurations.

Note that this configuration assumes you have one of the mod_php* modules installed. For PHP-FPM the configuration is a bit different.
 
I've seen numerous guides to getting php working with Apache and am having problems displaying

<?php phpinfo(); ?>

What is the minimum I need to install?

Is this sufficient?

sh:
cat <<EOF >/usr/local/etc/apache24/Includes/php.conf
<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>
EOF
Search google for "freebsd famp setup"
The old and good apache+php+mysql combo
 
Note to self.

Code:
#install pkgs
cat << EOF | xargs pkg install -y 
apache24
mod_php84
php84-extensions
EOF
       
#configure php

cat <<EOF >/usr/local/etc/apache24/modules.d/001_php.conf                                                                                                                                                       
<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>   
EOF
         
echo '<?php phpinfo(); ?>' > /usr/local/www/apache24/data/info.php

sysrc apache24_enable=YES

service apache24 start

This should be enough to show 192.168.1.22/info.php
1773144728338.png
 
so is apache, which has been on version 2.4 for WAY over a decade (I'm also using nginx, respectively angie FWIW)...
But I guess OP hasn't even tried to follow the dead-simple instructions in the handbook.
My problem wasn't about getting apache running but about how to get it working properly with php. The handbook mentions php74.

In fact it is quite useless when it comes to configuring interaction between apache and php.
 
The way mod_php is loaded and configured in Apache hasn't changed for a long time either.
 
And it was too confusing to just pick one of the currently available 'mod_php' packages?
I have seen lots of msgs about the use of incompatible php packages, and am intending to use quite a number of them at some point.
 
The problem is things keep changing and things don't always work as described.
nah,php+apache configuration is almost the same ...trough years and years
The rest if tweak some change here and there
If there is any problem

pd; the same in FreeBSD,there is no systemd here
 
I'm aiming to install Nextcloud including PostgeSQL and Drupal.
Maybe, you should try to organize those services inside service jail(s). I used to play with Drupal. I didn't know that nextcloud was in FreeBSD's pkg repos, I need to look at it.
 
Maybe, you should try to organize those services inside service jail(s). I used to play with Drupal. I didn't know that nextcloud was in FreeBSD's pkg repos, I need to look at it.
I read that you could incorporate various CMS's. I think I saw Drupal mentioned.

I just came across this link if anyone is interested in using Nextcloud with Drupal.
 
I have no idea about systemd and have no intention of ever finding out.

I hear that is one reason that Linux users are switching to FreeBSD.
You say

"The problem is things keep changing and things don't always work as described."
The only reason to argument that is, your are a linux user in the hell of systemd changes(that evolves everything more and more)

I hear that is one reason that Linux users are switching to FreeBSD.

I wish that, vermaden post an article in his latests news about systemd,very interesting
and the true that everybody knows,but wow,The rabbit hole is deep for "OneForRulesAllD"
 
Put it in /usr/local/etc/apache24/modules.d/001_php.conf
Not going to change how it works, but it keeps things a bit more organized. Use the Includes/ directory for your website configurations.

Note that this configuration assumes you have one of the mod_php* modules installed. For PHP-FPM the configuration is a bit different.
It seems that php-fpm is a modern replacement for mod_php.

What changes do I need to make if I want to use it?
 
Back
Top