A website I built frequently throws up the following code instead of the homepage:


// Path to your craft/ folder
$craftPath = '../craft';

// Do not edit below this line
$path = rtrim($craftPath, '/').'/app/index.php';

if (!is_file($path))
    if (function_exists('http_response_code'))

    exit('Could not find your craft/ folder. Please ensure that <strong><code>$craftPath</code></strong> is set correctly in '.__FILE__);

require_once $path;

I have followed the Craft CMS install guide to the letter. Here's the output from php.ini:

engine = On
zend.ze1_compatibility_mode = Off
short_open_tag = On
asp_tags = Off
precision    =  12
y2k_compliance = On
output_buffering = Off
zlib.output_compression = Off
implicit_flush = Off
serialize_precision = 100
safe_mode = Off
disable_functions =
expose_php = Off
max_execution_time = 600     ; Maximum execution time of each script, in seconds
max_input_time = 6000   ; Maximum amount of time each script may spend parsing request data
memory_limit = 768M      ; Maximum amount of memory a script may consume (128MB)
error_reporting  =  E_ALL & ~E_NOTICE
display_errors = Off
display_startup_errors = Off
log_errors = On
error_log = /var/sites/t/domain.com/public_html/error_log
log_errors_max_len = 1024
report_memleaks = On
track_errors = Off
variables_order = "EGPCS"
register_globals = Off
register_argc_argv = On
auto_globals_jit = On
upload_max_filesize = 100M
post_max_size = 100M
magic_quotes_runtime = Off
magic_quotes_gpc = Off
magic_quotes_sybase = Off
auto_prepend_file =
auto_append_file =
default_mimetype = "text/html"
extension_dir = "/usr/newage/lib/php/extensions/no-debug-non-zts-20151012"
enable_dl = Off
file_uploads = On
upload_tmp_dir = /tmp
allow_url_fopen = On
allow_url_include = Off
default_socket_timeout = 60
date.timezone = Europe/London
mysql.allow_persistent = On
mysql.max_persistent = -1
mysql.max_links = -1
mysql.default_port =
mysql.connect_timeout = 60
mysqli.max_links = -1
mysqli.default_port = 3306
mysqli.default_socket =
mysqli.default_user =
mysqli.default_pw =
mysqli.reconnect = On
session.save_handler = files
session.save_path = /tmp
session.use_cookies = 1
session.name = PHPSESSID
session.auto_start = 0
session.cookie_lifetime = 0
session.cookie_path = /
session.cookie_domain =
session.cookie_httponly = 
session.serialize_handler = php
session.gc_probability = 0
session.gc_divisor     = 100
session.gc_maxlifetime = 14400
session.bug_compat_42 = 1
session.bug_compat_warn = 1
session.referer_check =
session.entropy_length = 0
session.entropy_file =
session.cache_limiter = nocache
session.cache_expire = 180
session.use_trans_sid = 0
session.hash_function = 0


The error log set in php.ini is showing up empty.

Via the Craft CPanel, I'm seeing the following recurring errors from the logs tab:

CPanel logs

Here's the Server info via the Craft CPanel:

CPanel Server info

My host has told me that ImageMagick isn't available on the PHP version I'm running (7.1).

For iconv extension, the info bubble is reading:

You have a buggy version of iconv installed. (See PHP bug #48147 and iconv bug #13541

My host has recently fixed load issues on one of their hosting clusters, which I initially thought might be causing the problems, but I'm still getting 503 errors.

This may be unrelated, but the site also jumps from having normal permalinks, like so:


To messy permalinks, like this:


  • None of the information you've provided give any clues about any errors. 1) See if you can find any relevant entries in the Craft log (craft/storage/runtime/logs/ - check both craft.log and phperrors.log) 2) Check your webserver error logs, 503 are often logged there as well.
    – Erik Weber
    Commented Dec 19, 2017 at 13:01
  • I've looked through craft.log, craft.log.1, craft.log.2, craft.log.3, craft.log.4 and craft.log.5 under /logs. I can only find 404 errors here for 301 redirects I haven't set up. The php error log under /logs is just showing login errors, like so: [03-Dec-2017 13:11:28 UTC] PHP Warning: Declaration of Craft\UserSessionService::afterLogin() should be compatible with CWebUser::afterLogin($fromCookie) in /var/sites/t/domain.com/craft/app/services/UserSessionService.php on line 17. I've also checked the web server error logs (error_log), but this is completely blank.
    – Sam
    Commented Dec 19, 2017 at 15:06
  • This is very likely a server config issue, either your Apache config/.htaccess file or your Nginx config Commented Dec 19, 2017 at 18:57
  • You can ignore the iconv message. Imagick is definitely available for PHP 7.1. Where are you seeing the 503's? Not seeing from what you've shared. You can use this to remove index.php from URLs: craftcms.com/support/remove-index.php
    – Brad Bell
    Commented Dec 19, 2017 at 23:00
  • I'm not actually seeing a 503 error. The site loads code instead of the homepage frequently. The code indicates that it should show a 503 response. Question changed to reflect this. Tried the steps in the link you shared @BradBell, but it happens randomly, so can't troubleshoot the issue. Think a change in host is in order.
    – Sam
    Commented Dec 20, 2017 at 9:52

1 Answer 1


If your website is showing the text of your index.php instead of the actual website code, something is misconfigured with your server setup. Anything .php should be passed along to php-fpm or whatever CGI handler you're using.

  • I've migrated the site over to from TSO Host to Fortrabbit. Something wasn't right on their linux hosting, so hopefully I won't run into further issues.
    – Sam
    Commented Dec 21, 2017 at 9:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.