Hello,
I’m trying to configure my local environment and I’m running into this issue: can’t create any Custom Field.
Details:
I can access all sections of the CP and create entries (title only, since I can’t create fields). The error I get when I press “Create New” field is reported below. Any idea of what’s going wrong?
Thanks!
—
Exception Caught
SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘) ) ORDER BY Fieldtype_fieldtypes
.name
LIMIT 18446744073709551615’ at line 4:
SELECT Fieldtype_fieldtypes.fieldtype_id as Fieldtype__fieldtype_id, Fieldtype_fieldtypes.name as Fieldtype__name FROM (exp_fieldtypes
as Fieldtype_fieldtypes) WHERE ( binary Fieldtype_fieldtypes
.name
IN () ) ORDER BY Fieldtype_fieldtypes
.name
LIMIT 18446744073709551615
ee/legacy/database/drivers/mysqli/mysqli_connection.php:122
Stack Trace:
The appearance is that you are either missing files, PHP cannot read the files, or your installation did not complete successfully and your database has integrity issues. Let’s eliminate them in reverse order: can you browse to your exp_fieldtypes
table and let me know its full contents?
Hi Derek, thank you for your reply.
This is what the table exp_fieldtypes looks like (hope this is readable in some way).
Thanks.
1 fieldtype_idPrimary int(4) UNSIGNED No None AUTO_INCREMENT
2 name varchar(50) utf8_unicode_ci No None
3 version varchar(12) utf8_unicode_ci No None
4 settings text utf8_unicode_ci Yes NULL
5 has_global_settings char(1) utf8_unicode_ci Yes n
PartitionsDocumentation
No partitioning defined!
Information
Table comments:
Space usage Data 16 KiB Index 0 B Total 16 KiB Row statistics Format Compact Collation utf8_unicode_ci Next autoindex 15 Creation May 02, 2017 at 10:36 AM
Hi Derek, ok I hope this is the correct info: (I’m inexperienced with databases)
fieldtype_id name version settings has_global_settings
1 select 1.0.0 YTowOnt9 n
2 text 1.0.0 YTowOnt9 n
3 textarea 1.0.0 YTowOnt9 n
4 date 1.0.0 YTowOnt9 n
5 email_address 1.0.0 YTowOnt9 n
6 file 1.0.0 YTowOnt9 n
7 grid 1.0.0 YTowOnt9 n
8 multi_select 1.0.0 YTowOnt9 n
9 checkboxes 1.0.0 YTowOnt9 n
10 radio 1.0.0 YTowOnt9 n
11 relationship 1.0.0 YTowOnt9 n
12 rte 1.0.1 YTowOnt9 n
13 toggle 1.0.0 YTowOnt9 n
14 url 1.0.0 YTowOnt9 n
Yes, that is what I’m looking for, thanks. That table looks correct. This next bit is a little technical, but since this is running on your machine I can’t help diagnose directly. Some of our own team uses MAMP without any issues, so I’m really not even sure where to start looking at what might be wrong, so I just want to know where it’s failing. Essentially your installation is reporting that there are no fieldtypes installed, leading to the empty IN()
clause in the query, which is invalid in MySQL. We can do these one at a time to minimize confusion.
In a new PHP enabled-template, add:
<?php
$addons = ee('Addon')->installed();
if (empty($addons))
{
exit('failed');
}
echo "<pre>";
foreach ($addons as $addon)
{
echo $addon->getName().': ';
echo ($addon->hasFieldtype()) ? 'Has' : 'Does not have';
echo " fieldtype\n";
}
?>
Access the template and cut and paste the results here.
When I visit the template I see this: Channel: Does not have fieldtypenComment: Does not have fieldtypenFile: Does not have fieldtypenFilePicker: Does not have fieldtypenMember: Does not have fieldtypenRelationships: Does not have fieldtypenRich Text Editor: Does not have fieldtypenSearch: Does not have fieldtypenStatistics: Does not have fieldtypen
Did you cut and paste, and include the \
in echo " fieldtype\n";
? Those should have each been output on a line by themselves, with fieldtype spelled correctly. 😉
Your installation is missing all fieldtypes, including from add-ons that are showing as installed that include fieldtypes. Replace the code above with:
<?php
echo "<pre>";
var_dump(glob(PATH_ADDONS.'*/ft.*.php'));
?>
Pase the results, as before.
Ok you are somehow missing all of the fieldtype files. Look in your system/ee/EllisLab/Addons
folders (checkboxes, email, toggle, and url for instance all are fieldtypes). The complete list is:
/system/ee/EllisLab/Addons/checkboxes/ft.checkboxes.php
/system/ee/EllisLab/Addons/date/ft.date.php
/system/ee/EllisLab/Addons/email_address/ft.email_address.php
/system/ee/EllisLab/Addons/file/ft.file.php
/system/ee/EllisLab/Addons/grid/ft.grid.php
/system/ee/EllisLab/Addons/hidden/ft.hidden.php
/system/ee/EllisLab/Addons/multi_select/ft.multi_select.php
/system/ee/EllisLab/Addons/radio/ft.radio.php
/system/ee/EllisLab/Addons/relationship/ft.relationship.php
/system/ee/EllisLab/Addons/rte/ft.rte.php
/system/ee/EllisLab/Addons/select/ft.select.php
/system/ee/EllisLab/Addons/text/ft.text.php
/system/ee/EllisLab/Addons/textarea/ft.textarea.php
/system/ee/EllisLab/Addons/toggle/ft.toggle.php
/system/ee/EllisLab/Addons/url/ft.url.php
If they exist, check file permissions on them to make sure they are readable. If everything is there and permissions are intact, then you have something in your environment that is preventing PHP’s glob()
function from working properly, or in your config that is setting paths incorrectly. If none of the above reveal the issue, do a gut check, in the PHP enabled template:
<?php
var_dump(PATH_ADDONS);
?>
That should be a correct full server path to the system/ee/EllisLab/Addons
folder.
Hi Derek, all the files and permissions were there, and the php code returned the correct path, but I always got the error.
After some trial-and-error I found that the environment didn’t like the name of the project folder in the path, something like: Site 1 [EE]/def/dest
Without the square brackets in the path, it’s working — well, it’s also working with empty brackets [], but NOT with something between the brackets, like [aaa].
I don’t know if this makes sense to you, or if it sounds like a total beginner mistake… anyway I’m happy it’s working now 😊
Thank you for your quick support!
Ah, the unix-based glob
treats brackets as special characters, so PHP’s glob()
function does likewise, and thinks your directory name is looking for a regex-like character class, e.g. folder[name]
would match foldern
, foldera
, folderm
, and foldere
, but not foldername
. So ExpressionEngine is unable to find your add-on folders. Super edge case, and I’d wager that using brackets in file paths is not common, I’d just avoid that and use dashes, underscores, or subfolders to keep your directories organized.
Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.