Skip to content

Instantly share code, notes, and snippets.

@Abban
Last active December 18, 2015 17:28
Show Gist options
  • Save Abban/5818362 to your computer and use it in GitHub Desktop.
Save Abban/5818362 to your computer and use it in GitHub Desktop.
Get Anchor CMS Working on PHP 5.3.0+
<?php
// In anchor/libraries/anchor.php change lines 50 -65 from:
public static function functions() {
if( ! is_admin()) {
$fi = new FilesystemIterator(APP . 'functions', FilesystemIterator::SKIP_DOTS);
foreach($fi as $file) {
if($file->isFile() and $file->isReadable() and '.' . $file->getExtension() == EXT) {
require $file->getPathname();
}
}
// include theme functions
if(is_readable($path = PATH . 'themes' . DS . Config::meta('theme') . DS . 'functions.php')) {
require $path;
}
}
}
// To
public static function functions() {
if( ! is_admin()) {
$fi = new FilesystemIterator(APP . 'functions', FilesystemIterator::SKIP_DOTS);
foreach($fi as $file) {
$ext = (version_compare(PHP_VERSION, '5.3.6') < 0) ? pathinfo($file, PATHINFO_EXTENSION) : $file->getExtension();
if($file->isFile() and $file->isReadable() and '.' . $ext == EXT) {
require $file->getPathname();
}
}
// include theme functions
if(is_readable($path = PATH . 'themes' . DS . Config::meta('theme') . DS . 'functions.php')) {
require $path;
}
}
}
<?php
//In system/boot.php change lines 16 - 19 from
if(version_compare(PHP_VERSION, '5.3.6') < 0) {
echo 'We need PHP 5.3.6 or higher, you are running ' . PHP_VERSION;
exit;
}
// To
if(version_compare(PHP_VERSION, '5.3.0') < 0) {
echo 'We need PHP 5.3.6 or higher, you are running ' . PHP_VERSION;
exit;
}
@katejenkins
Copy link

Worked!!! Thanks for taking the time to share this gist!

I was preparing to spend my day breaking everything on my server by manually upgrading to 5.3.6. You just saved me an entire day of hating my life. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment