Trying out latest FusionPBX - Fatal error: Uncaught TypeError: fwrite():

question

New Member
Mar 30, 2026
8
0
1
64
Latest install of FusionPBX with FreeSWITCH v1.11.0 on new AWS EC2 instance of Debian 13. If I try to save anything in Advanced > Variables it gives:

Fatal error: Uncaught TypeError: fwrite(): Argument #1 ($stream) must be of type resource, bool given in /var/www/fusionpbx/resources/switch.php:329 Stack trace: #0 /var/www/fusionpbx/resources/switch.php(329): fwrite() #1 /var/www/fusionpbx/app/vars/var_edit.php(148): save_var_xml() #2 {main} thrown in /var/www/fusionpbx/resources/switch.php on line 329

Permissions of vars.xml look correct:
-rw-r--r-- 1 www-data www-data 4668 May 22 11:29 /etc/freeswitch/vars.xml
 
I am getting the same error as well
I found the problem. In switch.php line 293, fopen fails because the directory is read only to FusionPBX. The file permissions are OK but Systemd security is interfering.

I have reported this to support to get an official solution.
 
For those need a quick fix, update /var/www/fusionpbx/resources/switch.php line 293 replacing "w" to "rw":
PHP:
$fout = fopen($switch_conf_dir."/vars.xml","rw");

No success with w+ or r+

Code:
- Application
  - version: 5.5.10
  - branch: 5.5
  - path: /var/www/fusionpbx
- PHP
  - version: 8.2.31
  - apcu enabled: false
- Switch
  - version: 1.11.0
- Database
  - name: PostgreSQL
  - version: 17.10
- Operating System
  - name: Debian
  - version: 12
 
Last edited: