Forum
Scheduled Task Error
Hi,
I am setting up a scheduled task and am getting this error:
PHP Notice: Undefined index: SERVER_NAME in /var/www/html/admin/config/config.php on line 2
This is my config.php
file (some details removed):
<?php
switch($_SERVER['SERVER_NAME']) {
case 'clientsite.loc':
include(__DIR__.'/config.clientsite-loc.php');
break;
case 'clientsite.staging.co.uk':
include(__DIR__.'/config.clientsite-staging.php');
break;
case 'dev.clientsite.co.uk':
include(__DIR__.'/config.clientsite-dev.php');
break;
default:
include(__DIR__.'/config.production.php');
break;
}
define('PERCH_LICENSE_KEY', 'XXXXXX-XXXXXX-XXXXXX-XXXXXX-XXXXXX');
define('PERCH_EMAIL_FROM', 'info@client-site.co.uk');
define('PERCH_EMAIL_FROM_NAME', 'Client');
define('PERCH_LOGINPATH', '/admin');
define('PERCH_PATH', str_replace(DIRECTORY_SEPARATOR.'config', '', __DIR__));
define('PERCH_CORE', PERCH_PATH.DIRECTORY_SEPARATOR.'core');
define('PERCH_RESFILEPATH', PERCH_PATH . DIRECTORY_SEPARATOR . 'resources');
define('PERCH_RESPATH', PERCH_LOGINPATH . '/resources');
define('PERCH_HTML5', true);
define('PERCH_TZ', 'UTC');
define('PERCH_CUSTOM_EDITOR_CONFIGS', true);
The individual config files contain db details, PERCH_SCHEDULE_SECRET
and PERCH_SITEPATH
in each.
Any thoughts what could be causing the error?
This is my diagnostics:
Perch Runway: 3.1.1, PHP: 7.0.30-0ubuntu0.16.04.1, MySQL: mysqlnd 5.0.12-dev - 20150407 - $Id: b5c5906d452ec590732a93b051f3827e02749b83 $, with PDO
Server OS: Linux, apache2handler
Installed apps: content (3.1.1), assets (3.1.1), categories (3.1.1), perch_forms (1.11), perch_twitter (4.0)
App runtimes: <?php $apps_list = [ 'perch_twitter', 'perch_forms', 'casino36_crm' ];
PERCH_LOGINPATH: /admin
PERCH_PATH: /var/www/html/admin
PERCH_CORE: /var/www/html/admin/core
PERCH_RESFILEPATH: /var/www/html/admin/resources
Image manipulation: GD
PHP limits: Max upload 2M, Max POST 8M, Memory: 128M, Total max file upload: 2M
F1: 3b606135b33e6a102526838f4152a807
Resource folder writeable: Yes
HTTP_HOST: dev.casino36.co.uk
DOCUMENT_ROOT: /var/www/html
REQUEST_URI: /admin/core/settings/diagnostics/
SCRIPT_NAME: /admin/core/settings/diagnostics/index.php
SERVER_NAME
isn't available in the CLI environment, so test for it before you use it.