Last call to make your voice heard! Our 2022 Developer Survey closes in less than a week. Take survey.
47 votes
Accepted

413 “Request Entity Too Large” error with uploading a file

413 errors occur when the request body is larger than the server is configured to allow. Here’s how you can fix it, depending on your web server: Apache: Set the LimitRequestBody directive in either ...
user avatar
25 votes
Accepted

Why are some entry detail views empty in the control panel?

That error isn't a Craft or PHP error, it's coming from older versions of xDebug. It can happen on more complicated pages (lots of fields, tabs, etc.), but you can get around it by adjusting the ...
user avatar
  • 66.4k
24 votes
Accepted

FastCGI error when accessing a local development site using MAMP Pro

Following the answer in this issue https://stackoverflow.com/questions/15563217/apache2-fastcgi-comm-with-dynamic-server-aborted-first-read-idle-timeout/15565267#15565267 I was able to successfully ...
user avatar
  • 356
17 votes
Accepted

Return entries where field is "not empty"

1. "Expected name or number" error The parser is expecting a method/property after the dot of productSale, but you are passing arguments. Removing the dot to make it valid: {% set products = craft....
user avatar
  • 8,316
16 votes
Accepted

How to display a flash message in a template

You can use the setFlash function in the userSession Service like this: In your Controller: craft()->userSession->setFlash('yourVariable', "Something happened yo!"); In your template (that ...
user avatar
  • 2,824
14 votes
Accepted

500 error on installation since version 2.3

I might be shooting in the sky, but make sure that in your in your .htaccess you have RewriteBase / after RewriteEngine On
user avatar
12 votes
Accepted

"Craft is unable to determine if an update is available at this time."

You'll get this if (for any reason) your local install can't connect to our web service that holds all of our update and release information. If this happens, your local install will cache that there ...
user avatar
  • 66.4k
9 votes
Accepted

Render generic message/error template from plugin

I'm not familiar with EE's show_error, but a plugin's error template logic is identical to the logic that Craft uses to determine what to display. From your plugin, if you: throw new HttpException($...
user avatar
  • 66.4k
7 votes

Does Craft have an installer error log I can check?

Typically the Craft logs are stored here: /craft/storage/runtime/logs I don't know how much logging the installer does, but if it does any at all, that's where you'll find the log data. In the ...
user avatar
  • 23.6k
7 votes

PHP Fatal error: Allowed memory size of X bytes exhausted

Craft will run out-of-the-box with 32M of memory, no problem. However, memory consumption will start to increase depending on several factors including: The complexity of your site, including the ...
user avatar
  • 66.4k
6 votes

change the root directory references

The actual web root name doesn’t matter. Usually it’s “public_html” or something similar, and Craft’s “public” folder is only meant to represent that folder. There are no references to the public/...
user avatar
6 votes
Accepted

Template error on local development when checking entry variable

You are close, instead of checking entry|length, you can do {% if entry is defined %} {% if entry is defined and entry.sectionId == 1 %} So if I am understanding correctly, the full code will be: {%...
user avatar
  • 3,594
6 votes
Accepted

Impossible to invoke a method on a null variable

Well, the first method only tries to get an asset model. But if there's no asset added to the field it simply returns null. So calling a method like getUrl, or accessing a property like url or title ...
user avatar
  • 35.8k
6 votes
Accepted

No input file specified - [proxy_fcgi:error] Got error 'Unable to open primary script: [PATH]/html/index.php (No such file or directory)\n'

It turned out that the problem was from customizing the domain's document root in the userdata files and then the PHP-FPM configuration had not been rebuilt and the service not restarted. The ...
user avatar
5 votes
Accepted

After updating, getting "Could not resolve the subpath" error

If you're setting an dynamic upload folder location for an Assets field inside of a Matrix field, you need to preface things like {slug} with {owner.slug}. See the note about dynamic subfolders on an ...
user avatar
  • 66.4k
5 votes
Accepted

How do I clear deprecation errors for looping through element queries?

What about using the all() function as well? Your field doesn't contain an array, it contains the same type of object like craft.entries provides. {% for flag in country.all() %} It doesn't appear ...
user avatar
4 votes
Accepted

Installation stops halfway. Files not found and internal server error 500

The log file got me on my way after a tip from Brad Bell: 'CDbException' with message 'CDbCommand failed during the SQL statement: SQLSTATE[42S01]: Base table or view already exists: 1050 Table '...
user avatar
  • 1,032
4 votes

Does Craft have an installer error log I can check?

All of Craft's log files get stored in craft/storage/runtime/logs. If you're running in devMode, then any log message with a trace, info, warning or error severity error will get logged there in ...
user avatar
  • 66.4k
4 votes
Accepted

Craft 2.2 with enabled enableCsrfProtection: Failed to load resource: the server responded with a status of 400 (Bad Request)

I can confirm this is a bug on Craft 2.2.2579 when CSRF protection is enabled. Will get a fix out for it shortly and update this answer when it's done. Update: Fixed in Craft 2.2.2582.
user avatar
  • 66.4k
4 votes

"Craft is unable to determine if an update is available at this time."

I cleared the cache to no avail. After combing through error logs, I found I had an error with my curl and ssl setup via homebrew. After re-installing those items and reinstalling php55 like so... ...
user avatar
  • 133
4 votes

Getting "Session Ended" popup in admin

We were experiencing this issue, as well as the randomly logging out issue. As I answered on that question, we fixed both these issues by switching session.auto_start to Off session.auto_start = 0
user avatar
  • 171
4 votes
Accepted

Plugins page inside CP Settings not working

Sounds like an FTP upload or an unzipping operation didn't finish properly. Try downloading a fresh copy of Craft from http://buildwithcraft.com and replacing the old craft/app folder with the new ...
user avatar
  • 66.4k
4 votes

PHP Error log in CP gives me 403 forbidden

Had the same problem. I my case, it was the following code in my nginx config file: location ~* (?:\.(?:bak|config|sql|fla|ini|log|sh|inc|swp|dist)|~)$ { deny all; } After removing log| from the ...
user avatar
4 votes

500 error on installation since version 2.3

In case it helps someone, my issue was the permissions for the root index.php file...It was 666 (writeable by group) and when I switched that file permissions to 644, the installation was able to move ...
user avatar
  • 61
4 votes

Fatal error: Class 'Craft\FileCache' not found when trying to install

After checking out the craft/app/etc folder, I noticed the cache folder was missing. It turns out that the problem was with my FTP client ignoring folders named "cache". So really a dumb mistake on my ...
user avatar
  • 346
4 votes

How to move repeating code into an include template

That seo code will need to be in a block of its own. Create a seo block in your _layout template and then wrap your seo code in your include template with block tags of the same name.
user avatar
  • 249
4 votes

How to move repeating code into an include template

What I do is to handle the metadata in a macro that I call from _layout, which is passed the _context twig global variable In _layout.html: {% import '_macros/_metaData' as m_metaData %} <head>...
user avatar
4 votes
Accepted

Returning errors into templates

I just return the form model object back to the template. Yii has built in validation and error handling within the models themselves. In the example email is the instance of your form's model. The ...
user avatar
4 votes
Accepted

Use of undefined constant JSON_HEX_TAG

You're likely missing the PHP JSON extension, which is a requirement to run Craft.
user avatar
  • 66.4k
4 votes

Craft internal error exposing sensitive data

Your guess is correct... as the docs say, you should never have devMode enabled in production environments specifically for reasons like this (as well as many others). If you find errors that are ...
user avatar
  • 66.4k

Only top scored, non community-wiki answers of a minimum length are eligible