Tutorial for RaspberryPi 4 Installation

I know little about this.

Try fwconsole chown

FreePBX is fussy about PHP version. Check that what you’re running is correct for the FreePBX version.

Look at the Apache error log.

Perhaps

will help.

Otherwise, I hope that a PHP guru will answer.

Hello,

OK, this is what apache error.log says…

[Mon Mar 06 00:00:02.479940 2023] [mpm_prefork:notice] [pid 600] AH00163: Apache/2.4.54 (Debian) configured – resuming normal operations
[Mon Mar 06 00:00:02.480050 2023] [core:notice] [pid 600] AH00094: Command line: ‘/usr/sbin/apache2’
[Mon Mar 06 14:09:19.955318 2023] [:error] [pid 31414] [client 192.168.0.145:53284] PHP Warning: include_once(/etc/freepbx.conf): failed to open stream: Permission denied in /var/www/html/admin/config.php on line 127
[Mon Mar 06 14:09:19.955494 2023] [:error] [pid 31414] [client 192.168.0.145:53284] PHP Warning: include_once(): Failed opening ‘/etc/freepbx.conf’ for inclusion (include_path=‘.:/usr/share/php’) in /var/www/html/admin/config.>
[Mon Mar 06 14:09:19.955565 2023] [:error] [pid 31414] [client 192.168.0.145:53284] PHP Fatal error: Class ‘FreePBX’ not found in /var/www/html/admin/config.php on line 137
[Mon Mar 06 14:09:19.955830 2023] [:error] [pid 31414] [client 192.168.0.145:53284] PHP Warning: Unknown: open(/var/lib/php/sessions/sess_iuu2osl6qrtn2dpfb4t48anpe5, O_RDWR) failed: Permission denied (13) in Unknown on line 0
[Mon Mar 06 14:09:19.955896 2023] [:error] [pid 31414] [client 192.168.0.145:53284] PHP Warning: Unknown: Failed to write session data (files). Please verify that the current setting of session.save_path is correct (/var/lib/p>

It seems to be an permission problem, but how to set them corectly?

What was the output of
fwconsole chown
given at a root shell prompt?

root@FreePBX:/var/log/apache2# fwconsole chown
Taking too long? Customize the chown command, See Sangoma Documentation
Setting Permissions…
Setting base permissions…Done in 2 seconds
Setting specific permissions…
22442 [============================]
Finished setting permissions
root@FreePBX:/var/log/apache2#

1 Like

So there was no error from chown but the permission problem persists. I’m guessing that httpd is not running as the asterisk user. Check with ps whether this is the case. I believe that the User and Group should be set to asterisk in the main httpd.conf file. Perhaps that got overwritten by the same issue that caused index.html in the document root, though I don’t know what that may be.

hmm,
i can’t find httpd in ps…

root@FreePBX:/var/log/apache2# ps aux
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
root 1 0.0 0.1 165244 10152 ? Ss Mar05 0:04 /sbin/init
root 2 0.0 0.0 0 0 ? S Mar05 0:00 [kthreadd]
root 3 0.0 0.0 0 0 ? I< Mar05 0:00 [rcu_gp]
root 4 0.0 0.0 0 0 ? I< Mar05 0:00 [rcu_par_gp]
root 5 0.0 0.0 0 0 ? I< Mar05 0:00 [slub_flushwq]
root 6 0.0 0.0 0 0 ? I< Mar05 0:00 [netns]
root 10 0.0 0.0 0 0 ? I< Mar05 0:00 [mm_percpu_wq]
root 11 0.0 0.0 0 0 ? S Mar05 0:00 [rcu_tasks_kthre]
root 12 0.0 0.0 0 0 ? S Mar05 0:00 [rcu_tasks_rude_]
root 13 0.0 0.0 0 0 ? S Mar05 0:00 [rcu_tasks_trace]
root 14 0.0 0.0 0 0 ? S Mar05 0:01 [ksoftirqd/0]
root 15 0.0 0.0 0 0 ? I Mar05 0:09 [rcu_preempt]
root 16 0.0 0.0 0 0 ? S Mar05 0:00 [migration/0]
root 17 0.0 0.0 0 0 ? S Mar05 0:00 [cpuhp/0]
root 18 0.0 0.0 0 0 ? S Mar05 0:00 [cpuhp/1]
root 19 0.0 0.0 0 0 ? S Mar05 0:00 [migration/1]
root 20 0.0 0.0 0 0 ? S Mar05 0:01 [ksoftirqd/1]
root 23 0.0 0.0 0 0 ? S Mar05 0:00 [cpuhp/2]
root 24 0.0 0.0 0 0 ? S Mar05 0:00 [migration/2]
root 25 0.0 0.0 0 0 ? S Mar05 0:00 [ksoftirqd/2]
root 27 0.0 0.0 0 0 ? I< Mar05 0:02 [kworker/2:0H-kblockd]
root 28 0.0 0.0 0 0 ? S Mar05 0:00 [cpuhp/3]
root 29 0.0 0.0 0 0 ? S Mar05 0:00 [migration/3]
root 30 0.0 0.0 0 0 ? S Mar05 0:00 [ksoftirqd/3]
root 32 0.0 0.0 0 0 ? I< Mar05 0:02 [kworker/3:0H-kblockd]
root 33 0.0 0.0 0 0 ? S Mar05 0:00 [kdevtmpfs]
root 34 0.0 0.0 0 0 ? I< Mar05 0:00 [inet_frag_wq]
root 39 0.0 0.0 0 0 ? S Mar05 0:00 [kauditd]
root 41 0.0 0.0 0 0 ? S Mar05 0:00 [khungtaskd]
root 42 0.0 0.0 0 0 ? S Mar05 0:00 [oom_reaper]
root 43 0.0 0.0 0 0 ? I< Mar05 0:00 [writeback]
root 44 0.0 0.0 0 0 ? S Mar05 0:06 [kcompactd0]
root 66 0.0 0.0 0 0 ? I< Mar05 0:00 [kblockd]
root 67 0.0 0.0 0 0 ? I< Mar05 0:00 [blkcg_punt_bio]
root 68 0.0 0.0 0 0 ? S Mar05 0:00 [watchdogd]
root 71 0.0 0.0 0 0 ? I< Mar05 0:00 [rpciod]
root 72 0.0 0.0 0 0 ? I< Mar05 0:00 [kworker/u9:0-hci0]
root 73 0.0 0.0 0 0 ? I< Mar05 0:00 [xprtiod]
root 75 0.0 0.0 0 0 ? S Mar05 0:00 [kswapd0]
root 76 0.0 0.0 0 0 ? I< Mar05 0:00 [nfsiod]
root 77 0.0 0.0 0 0 ? I< Mar05 0:00 [kthrotld]
root 78 0.0 0.0 0 0 ? I< Mar05 0:00 [iscsi_eh]
root 79 0.0 0.0 0 0 ? I< Mar05 0:00 [iscsi_conn_clea]
root 80 0.0 0.0 0 0 ? I< Mar05 0:00 [nvme-wq]
root 81 0.0 0.0 0 0 ? I< Mar05 0:00 [nvme-reset-wq]
root 82 0.0 0.0 0 0 ? I< Mar05 0:00 [nvme-delete-wq]
root 84 0.0 0.0 0 0 ? I< Mar05 0:00 [DWC Notificatio]
root 85 0.0 0.0 0 0 ? I< Mar05 0:00 [uas]
root 86 0.0 0.0 0 0 ? S< Mar05 0:00 [vchiq-slot/0]
root 87 0.0 0.0 0 0 ? S< Mar05 0:00 [vchiq-recy/0]
root 88 0.0 0.0 0 0 ? S< Mar05 0:00 [vchiq-sync/0]
root 89 0.0 0.0 0 0 ? I< Mar05 0:00 [zswap-shrink]
root 90 0.0 0.0 0 0 ? I< Mar05 0:00 [sdhci]
root 92 0.0 0.0 0 0 ? S Mar05 0:00 [irq/47-mmc0]
root 95 0.0 0.0 0 0 ? I< Mar05 0:00 [mmc_complete]
root 96 0.0 0.0 0 0 ? I< Mar05 0:05 [kworker/1:1H-kblockd]
root 97 0.0 0.0 0 0 ? S Mar05 0:01 [jbd2/mmcblk0p2-]
root 98 0.0 0.0 0 0 ? I< Mar05 0:00 [ext4-rsv-conver]
root 103 0.0 0.0 0 0 ? I< Mar05 0:00 [mld]
root 104 0.0 0.0 0 0 ? I< Mar05 0:00 [ipv6_addrconf]
root 137 0.0 0.2 40944 20432 ? Ss Mar05 0:10 /lib/systemd/systemd-journald
root 169 0.0 0.0 21640 6252 ? Ss Mar05 0:01 /lib/systemd/systemd-udevd
root 208 0.0 0.0 0 0 ? S Mar05 0:00 [vchiq-keep/0]
root 209 0.0 0.0 0 0 ? S< Mar05 0:00 [SMIO]
root 228 0.0 0.0 0 0 ? I< Mar05 0:00 [mmal-vchiq]
root 232 0.0 0.0 0 0 ? S Mar05 0:00 [irq/60-feb10000]
root 234 0.0 0.0 0 0 ? I< Mar05 0:00 [mmal-vchiq]
root 235 0.0 0.0 0 0 ? I< Mar05 0:00 [mmal-vchiq]
root 239 0.0 0.0 0 0 ? I< Mar05 0:00 [mmal-vchiq]
root 242 0.0 0.0 0 0 ? I< Mar05 0:00 [mmal-vchiq]
root 247 0.0 0.0 0 0 ? I< Mar05 0:00 [mmal-vchiq]
root 248 0.0 0.0 0 0 ? I< Mar05 0:00 [mmal-vchiq]
root 254 0.0 0.0 0 0 ? S Mar05 0:00 [v3d_bin]
root 255 0.0 0.0 0 0 ? S Mar05 0:00 [v3d_render]
root 256 0.0 0.0 0 0 ? S Mar05 0:00 [v3d_tfu]
root 257 0.0 0.0 0 0 ? S Mar05 0:00 [v3d_csd]
root 258 0.0 0.0 0 0 ? S Mar05 0:00 [v3d_cache_clean]
root 271 0.0 0.0 0 0 ? I< Mar05 0:00 [cfg80211]
root 276 0.0 0.0 0 0 ? S Mar05 0:00 [irq/38-vc4 hdmi]
root 277 0.0 0.0 0 0 ? S Mar05 0:00 [irq/39-vc4 hdmi]
root 278 0.0 0.0 0 0 ? S Mar05 0:00 [cec-vc4]
root 279 0.0 0.0 0 0 ? S Mar05 0:00 [irq/35-vc4 hdmi]
root 280 0.0 0.0 0 0 ? S Mar05 0:00 [irq/34-vc4 hdmi]
root 282 0.0 0.0 0 0 ? I< Mar05 0:00 [brcmf_wq/mmc1:0]
root 284 0.0 0.0 0 0 ? S Mar05 0:00 [brcmf_wdog/mmc1]
root 307 0.0 0.0 0 0 ? S Mar05 0:00 [irq/44-vc4 hdmi]
root 308 0.0 0.0 0 0 ? S Mar05 0:00 [irq/45-vc4 hdmi]
root 309 0.0 0.0 0 0 ? S Mar05 0:00 [cec-vc4]
root 313 0.0 0.0 0 0 ? S Mar05 0:00 [irq/41-vc4 hdmi]
root 314 0.0 0.0 0 0 ? S Mar05 0:00 [irq/40-vc4 hdmi]
root 342 0.0 0.0 0 0 ? S Mar05 0:00 [card1-crtc0]
root 343 0.0 0.0 0 0 ? S Mar05 0:00 [card1-crtc1]
root 344 0.0 0.0 0 0 ? S Mar05 0:00 [card1-crtc2]
root 345 0.0 0.0 0 0 ? S Mar05 0:00 [card1-crtc3]
root 346 0.0 0.0 0 0 ? S Mar05 0:00 [card1-crtc4]
root 347 0.0 0.0 0 0 ? S Mar05 0:00 [card1-crtc5]
systemd+ 349 0.0 0.0 88128 6080 ? Ssl Mar05 0:00 /lib/systemd/systemd-timesyncd
avahi 386 0.0 0.0 7072 2696 ? Ss Mar05 0:13 avahi-daemon: running [FreePBX.local]
root 387 0.0 0.0 7688 2432 ? Ss Mar05 0:01 /usr/sbin/cron -f
message+ 388 0.0 0.0 8172 3812 ? Ss Mar05 0:00 /usr/bin/dbus-daemon --system --address=systemd: --nofork --nopidfile --systemd-activation --syslog-only
root 392 0.0 0.0 233992 6476 ? Ssl Mar05 0:00 /usr/libexec/polkitd --no-debug
avahi 402 0.0 0.0 6892 308 ? S Mar05 0:00 avahi-daemon: chroot helper
root 403 0.0 0.0 220884 3296 ? Ssl Mar05 0:01 /usr/sbin/rsyslogd -n -iNONE
root 413 0.0 0.0 14412 6480 ? Ss Mar05 0:00 /lib/systemd/systemd-logind
nobody 414 0.0 0.0 5484 2416 ? Ss Mar05 0:01 /usr/sbin/thd --triggers /etc/triggerhappy/triggers.d/ --socket /run/thd.socket --user nobody --deviceglob /dev/input/event*
root 419 0.0 0.0 13580 4712 ? Ss Mar05 0:00 /sbin/wpa_supplicant -u -s -O /run/wpa_supplicant
root 479 0.0 0.0 92292 96 ? SLsl Mar05 0:01 /usr/sbin/rngd -r /dev/hwrng
root 507 0.0 0.2 396924 19396 ? Ssl Mar05 0:46 /usr/bin/python3 /usr/bin/fail2ban-server -xf start
root 513 0.0 0.1 317960 9884 ? Ssl Mar05 0:00 /usr/sbin/ModemManager
root 537 0.0 0.0 13852 2464 ? Ss Mar05 0:01 wpa_supplicant -B -c/etc/wpa_supplicant/wpa_supplicant.conf -iwlan0
root 546 0.0 0.0 13672 6556 ? Ss Mar05 0:00 sshd: /usr/sbin/sshd -D [listener] 0 of 10-100 startups
mysql 599 0.1 1.1 1762568 94324 ? Ssl Mar05 1:56 /usr/sbin/mariadbd
root 600 0.0 0.4 161312 33796 ? Ss Mar05 0:07 /usr/sbin/apache2 -k start
root 686 0.0 0.0 2124 136 ? S Mar05 0:00 /usr/bin/hciattach /dev/serial1 bcm43xx 3000000 flow -
root 687 0.0 0.0 0 0 ? I< Mar05 0:00 [kworker/u9:2-hci0]
root 700 0.0 0.1 23880 9276 ? Ss Mar05 0:00 /usr/libexec/bluetooth/bluetoothd
root 767 0.0 0.0 3116 1912 ? Ss Mar05 0:00 /usr/sbin/dhcpcd -w -q
asterisk 768 1.0 0.9 2268380 75436 ? Ssl Mar05 15:54 /usr/sbin/asterisk -g -f -p -U asterisk
root 771 0.0 0.0 6448 1496 tty1 Ss+ Mar05 0:00 /sbin/agetty -o -p – \u --noclear tty1 linux
asterisk 772 0.0 0.0 1808 424 ? S Mar05 0:01 astcanary /var/run/asterisk/alt.asterisk.canary.tweet.tweet.tweet 768
root 950 0.0 0.0 16092 7756 ? Ss Mar05 0:01 sshd: root@pts/0
root 953 0.0 0.1 16068 8236 ? Ss Mar05 0:00 /lib/systemd/systemd --user
root 954 0.0 0.0 169096 4752 ? S Mar05 0:00 (sd-pam)
root 972 0.0 0.0 8944 4644 pts/0 Ss Mar05 0:00 -bash
root 31318 0.0 0.0 0 0 ? I< Mar05 0:03 [kworker/0:0H-mmc_complete]
www-data 31414 0.0 0.1 162208 15792 ? S 00:00 0:00 /usr/sbin/apache2 -k start
www-data 31415 0.0 0.1 161360 10272 ? S 00:00 0:00 /usr/sbin/apache2 -k start
www-data 31416 0.0 0.1 161384 14592 ? S 00:00 0:00 /usr/sbin/apache2 -k start
www-data 31417 0.0 0.1 161360 10272 ? S 00:00 0:00 /usr/sbin/apache2 -k start
www-data 31418 0.0 0.1 161344 9152 ? S 00:00 0:00 /usr/sbin/apache2 -k start
www-data 75667 0.0 0.1 161344 9152 ? S 14:09 0:00 /usr/sbin/apache2 -k start
root 77994 0.0 0.0 0 0 ? I 14:54 0:00 [kworker/1:1-mm_percpu_wq]
root 78739 0.0 0.0 0 0 ? I 15:09 0:00 [kworker/3:2-events]
root 80208 0.0 0.0 0 0 ? I 15:39 0:00 [kworker/3:1-mm_percpu_wq]
root 80304 0.0 0.0 0 0 ? I 15:39 0:00 [kworker/u8:0-events_unbound]
root 80626 0.0 0.0 0 0 ? I 15:44 0:00 [kworker/0:0-events_power_efficient]
root 81466 0.0 0.0 0 0 ? I 16:01 0:00 [kworker/2:1-events_power_efficient]
root 81514 0.0 0.0 0 0 ? I< 16:02 0:00 [kworker/0:2H]
root 81609 0.0 0.0 0 0 ? I< 16:04 0:00 [kworker/1:2H]
root 81704 0.0 0.0 0 0 ? I< 16:06 0:00 [kworker/2:1H]
root 81705 0.0 0.0 0 0 ? I 16:06 0:00 [kworker/2:2-events_power_efficient]
root 81753 0.0 0.0 0 0 ? I< 16:07 0:00 [kworker/3:2H]
root 81902 0.0 0.0 0 0 ? I 16:09 0:00 [kworker/u8:2-flush-179:0]
root 81903 0.0 0.0 0 0 ? I 16:09 0:00 [kworker/1:0-mm_percpu_wq]
root 81951 0.0 0.0 0 0 ? I 16:10 0:00 [kworker/0:1-events_power_efficient]
root 82045 0.0 0.0 0 0 ? I 16:12 0:00 [kworker/2:0-events]
root 82046 0.0 0.0 0 0 ? I< 16:12 0:00 [kworker/0:1H]
root 82094 0.0 0.0 0 0 ? I< 16:13 0:00 [kworker/2:2H]
root 82145 0.0 0.0 0 0 ? I 16:14 0:00 [kworker/1:2-events]
root 82146 0.0 0.0 0 0 ? I 16:14 0:00 [kworker/u8:1-events_unbound]
root 82197 0.0 0.0 0 0 ? I 16:15 0:00 [kworker/0:2-events_power_efficient]
root 82247 0.0 0.0 10428 2892 pts/0 R+ 16:16 0:00 ps aux
root@FreePBX:/var/log/apache2#

but it looks like that only some of them are running with an own user and the most under root…

But apache2 is running as www-data, and that is your HTTP daemon.

Check in /etc/apache2/apache2.conf
(For completeness, also /etc/apache2/envvars )

www-data seems to be Debian/Ubuntu standard, but it is a bad choice of name as the configuration files and static web contents should not be owned by this user. See the quote in the second reply to permissions - What is the www-data user? - Ask Ubuntu

(Does FreePBX follow this rule?)

Sensitive data should be group, rather than user, protected.

The user running asterisk must be the same one as the user serving the /var/www/html directory, it is easier to change the webserver’s owner than FreePBX due to ‘hard-coded-ness’ of one of them

Hello,
I checked apache2.conf and there they say to check envars. So I changed the user and group there

envvars - default environment variables for apache2ctl

this won’t be correct after changing uid

unset HOME

for supporting multiple apache2 instances

if [ “${APACHE_CONFDIR##/etc/apache2-}” != “${APACHE_CONFDIR}” ] ; then
SUFFIX=“-${APACHE_CONFDIR##/etc/apache2-}”
else
SUFFIX=
fi

Since there is no sane way to get the parsed apache2 config in scripts, some

settings are defined via environment variables and then used in apache2ctl,

/etc/init.d/apache2, /etc/logrotate.d/apache2, etc.

export APACHE_RUN_USER=asterisk
export APACHE_RUN_GROUP=asterisk

temporary state file location. This might be changed to /run in Wheezy+1

export APACHE_PID_FILE=/var/run/apache2$SUFFIX/apache2.pid
export APACHE_RUN_DIR=/var/run/apache2$SUFFIX
export APACHE_LOCK_DIR=/var/lock/apache2$SUFFIX

Only /var/log/apache2 is handled by /etc/logrotate.d/apache2.

export APACHE_LOG_DIR=/var/log/apache2$SUFFIX

but now, apache2 don’t let me do stop or restart because of the run-dir

root@FreePBX:/usr/sbin# apache2 -k restart
[Tue Mar 07 16:01:49.918940 2023] [core:warn] [pid 155646] AH00111: Config variable ${APACHE_RUN_DIR} is not defined
apache2: Syntax error on line 80 of /etc/apache2/apache2.conf: DefaultRuntimeDir must be a valid directory, absolute or relative to ServerRoot
root@FreePBX:/usr/sbin#

But what should i put in for the run-dir?

Hello,

still noone with an idea??
I changed the user with chown of /var/run/apache2 (run dir) to asterisk, but that didn’t change something…

This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.