DateTimeZone command stopped working when I switched to virtual server
I used the following PHP code in shared hosting and it worked just fine:
$tzFrom = new DateTimeZone('America/New_York');
Now I am trying to use the same code on a virtual server and I开发者_高级运维 get this error:
Fatal error: Class 'DateTimeZone' not found in /var/www/vhosts/...com/httpdocs/.../footer10.php on line 69
Any idea why it's not working on the virtual server?
Thanks in advance,
John
DateTimeZone
was introduced with PHP 5.2. Your Virtual Server is likely running a previous version. Check the PHP version on the server and upgrade PHP on the server.
Note that support for PHP 5.2 ended on Dec, 9th, 2010. All users of PHP 5.2 are encouraged to upgrade to PHP 5.3. To prepare for upgrading to PHP 5.3, now that PHP 5.2's support ended, a migration guide available on http://php.net/migration53, details the changes between PHP 5.2 and PHP 5.3.
Run this code to check your PHP Version:
<?php phpinfo(); ?>
If you are using PHP < 5.2 than DateTimeZone ist not available.
精彩评论