Backups are failing

Backups are failing
Schmooze pbx version: 10.13.66-9

# sh /var/lib/asterisk/bin/backup.php
/var/lib/asterisk/bin/backup.php: line 2: ?php: No such file or directory
/var/lib/asterisk/bin/backup.php: line 3: syntax error near unexpected token `('
/var/lib/asterisk/bin/backup.php: line 3: `$restrict_mods						= array('backup' => true, 'core' => true, 'sysadmin' => true);

You have no php interpreter

Hi tm1000,
Tried to reinstall php

#yum reinstall php*

Running Transaction
  Installing : php-common-5.3.28-3.shmz65.4.125.x86_64                                                                         1/16 
  Installing : php-cli-5.3.28-3.shmz65.4.125.x86_64                                                                            2/16 
  Installing : php-5.3.28-3.shmz65.4.125.x86_64                                                                                3/16 
no rpmsave
no rpmsave
  Installing : php-devel-5.3.28-3.shmz65.4.125.x86_64                                                                          4/16 
  Installing : 1:php-pear-1.9.4-4.el6.noarch                                                                                   5/16 
  Installing : php-pdo-5.3.28-3.shmz65.4.125.x86_64                                                                            6/16 
  Installing : php-mysql-5.3.28-3.shmz65.4.125.x86_64                                                                          7/16 
  Installing : php-pear-DB-1.7.13-3.el6.noarch                                                                                 8/16 
  Installing : php-5.3-zend-guard-loader-5.5.0-5_el6.x86_64                                                                    9/16 
  Installing : php-ldap-5.3.28-3.shmz65.4.125.x86_64                                                                          10/16 
  Installing : php-xml-5.3.28-3.shmz65.4.125.x86_64                                                                           11/16 
  Installing : php-process-5.3.28-3.shmz65.4.125.x86_64                                                                       12/16 
  Installing : php-gd-5.3.28-3.shmz65.4.125.x86_64                                                                            13/16 
  Installing : php-intl-5.3.28-3.shmz65.4.125.x86_64                                                                          14/16 
  Installing : php-mbstring-5.3.28-3.shmz65.4.125.x86_64                                                                      15/16 
  Installing : php-digium_register-3.0.5-1_centos6.x86_64                                                                     16/16 
  Verifying  : php-digium_register-3.0.5-1_centos6.x86_64                                                                      1/16 
  Verifying  : php-5.3-zend-guard-loader-5.5.0-5_el6.x86_64                                                                    2/16 
  Verifying  : 1:php-pear-1.9.4-4.el6.noarch                                                                                   3/16 
  Verifying  : php-5.3.28-3.shmz65.4.125.x86_64                                                                                4/16 
  Verifying  : php-ldap-5.3.28-3.shmz65.4.125.x86_64                                                                           5/16 
  Verifying  : php-mysql-5.3.28-3.shmz65.4.125.x86_64                                                                          6/16 
  Verifying  : php-pdo-5.3.28-3.shmz65.4.125.x86_64                                                                            7/16 
  Verifying  : php-devel-5.3.28-3.shmz65.4.125.x86_64                                                                          8/16 
  Verifying  : php-xml-5.3.28-3.shmz65.4.125.x86_64                                                                            9/16 
  Verifying  : php-process-5.3.28-3.shmz65.4.125.x86_64                                                                       10/16 
  Verifying  : php-common-5.3.28-3.shmz65.4.125.x86_64                                                                        11/16 
  Verifying  : php-gd-5.3.28-3.shmz65.4.125.x86_64                                                                            12/16 
  Verifying  : php-intl-5.3.28-3.shmz65.4.125.x86_64                                                                          13/16 
  Verifying  : php-cli-5.3.28-3.shmz65.4.125.x86_64                                                                           14/16 
  Verifying  : php-mbstring-5.3.28-3.shmz65.4.125.x86_64                                                                      15/16 
  Verifying  : php-pear-DB-1.7.13-3.el6.noarch                                                                                16/16 

Installed:
  php.x86_64 0:5.3.28-3.shmz65.4.125                             php-5.3-zend-guard-loader.x86_64 0:5.5.0-5_el6                    
  php-cli.x86_64 0:5.3.28-3.shmz65.4.125                         php-common.x86_64 0:5.3.28-3.shmz65.4.125                         
  php-devel.x86_64 0:5.3.28-3.shmz65.4.125                       php-digium_register.x86_64 0:3.0.5-1_centos6                      
  php-gd.x86_64 0:5.3.28-3.shmz65.4.125                          php-intl.x86_64 0:5.3.28-3.shmz65.4.125                           
  php-ldap.x86_64 0:5.3.28-3.shmz65.4.125                        php-mbstring.x86_64 0:5.3.28-3.shmz65.4.125                       
  php-mysql.x86_64 0:5.3.28-3.shmz65.4.125                       php-pdo.x86_64 0:5.3.28-3.shmz65.4.125                            
  php-pear.noarch 1:1.9.4-4.el6                                  php-pear-DB.noarch 0:1.7.13-3.el6                                 
  php-process.x86_64 0:5.3.28-3.shmz65.4.125                     php-xml.x86_64 0:5.3.28-3.shmz65.4.125

Tried backup again. Produced same results

# sh backup.php 
backup.php: line 2: ?php: No such file or directory
backup.php: line 3: syntax error near unexpected token `('
backup.php: line 3: `$restrict_mods						= array('backup' => true, 'core' => true, 'sysadmin' => true);'

What has to be done to fix this? This server is a FreePBX Distro install.

what is the output of

/usr/bin/env php -v

WHY are you doing this. You are telling the bash interpreter to interpret a php script.

I didn’t even notice this in your first response why are you doing this through SH???

1 Like

I will show you what is reported when running backup using FreePBX gui for ‘Save and Run’ from Backup module:

Saving Backup 2…done!
sh: /var/lib/asterisk/bin/backup.php: Permission denied

Thejames asked to run:

# /usr/bin/env php -v
PHP 5.3.28 (cli) (built: Mar 31 2014 19:09:21) 
Copyright (c) 1997-2013 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2013 Zend Technologies
    with Zend Guard Loader v3.3, Copyright (c) 1998-2010, by Zend Technologies

Anytime you see “permission denied” run “fwconsole chown”

Thank you tm1000 fwconsole chown fixed the issue.