unexpected T_REQUIRE, expecting T_NS_SEPARATOR or ';' or '{'

I need some help here… I’m getting two errors in my code… that i’m trying to restore.

The command i am running is:

/var/www/html/whois/update_and_generate_emails >>/var/www/html/whois/src/Whois/logs/cron_log

PHP Parse error: syntax error, unexpected T_REQUIRE, expecting T_NS_SEPARATOR or ‘;’ or ‘{’ in /var/www/html/whois/Update_Database.php on line 3

PHP Fatal error: Uncaught exception ‘ErrorException’ with message ‘date(): It is not safe to rely on the system’s timezone settings. You are required to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected ‘America/Denver’ for ‘MDT/-6.0/DST’ instead’ in /var/www/html/whois/src/Whois/Logger.php:23
Stack trace:
#0 [internal function]: {closure}(2, ‘date(): It is n…’, ‘/var/www/html/w…’, 23, Array)
#1 /var/www/html/whois/src/Whois/Logger.php(23): date(‘l jS \of F Y H:…’, 1440375456)
#2 /var/www/html/whois/Get_Daily_Emails.php(105): Whois\Logger->__construct(’./logs/generate…’)
#3 {main}
thrown in /var/www/html/whois/src/Whois/Logger.php on line 23

So this is line 3 of the first error Update_Database.php

<?php namespace Whois require 'src/Whois/cliConfig.php'; require 'vendor/autoload.php'; ini_set('memory_limit','-1'); $options = getopt('d::t::f::r::l::s::c::h::'); chdir(EXECUTION_PATH); And i'm not sure what i need to do to fix the second error. Any guidance is so much appreciated.

Well, not sure about those errors without knowing more about your code. But, my guess is that it is the
‘getopt’ command. You tell it to get option ‘d’ then, option NULL, then option ‘t’ , etc… As far as I know,
you use one single colon after each of the options, not double-colons. Try that first and see if it works.

I am assuming that line 23 of Logger.php is calling the Update_Dabase.php file and that is why it shows
your trace dump.

Let us know if that helps!

PHP is expecting a semicolon after you declare your namespace.

For the second error,do a search in your php.in I file for the time zone setting. It may be commented out or a null string.

Shouldn’t your namespace be in the class? For example, all my classes have namespaces at the top:
[php]<?php

namespace website_project\users;

use PDO;

class Members {

private $connectPDO;
private $pdo;
protected $id = NULL;
// ... more code ..[/php]

and I would assume (You know what they say about assuming ;D) that your use statement should go after the autoloader?

for example this how I utilize my login class in my utilities.inc.php file:
[php]use website_project\users\Members as Login;[/php]

of course I could be all wet for I only seeing a snippet of your project. :wink:

Sponsor our Newsletter | Privacy Policy | Terms of Service