Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 1 Mar 2022 08:49:29 -0700 (MST)
From:      Dale Scott <dalescott@shaw.ca>
To:        freebsd-questions <freebsd-questions@freebsd.org>
Subject:   file upload issues with SuiteCRM V7/8 (or apache24 and php8 diff FreeBSD vs Debian)
Message-ID:  <637715396.61990484.1646149769165.JavaMail.zimbra@shaw.ca>

next in thread | raw e-mail | index | archive | help
Is anyone using SuiteCRM on FreeBSD, and if so, did you have to do anything=
 beyond following the installation instructions?

I have tested both SuiteCRM V7 and V8 on FreeBSD V13 using Apache 2.4 and P=
HP 8.0, and get errors accessing uploaded files. The files are uploaded and=
 end up in the .../suitecrm/uploads/ directory, but they cannot be accessed=
 after uploading. The simplest example is uploading a profile photo (800x94=
4 JPG). After uploading, the image doesn't get rendered in the profile page=
 and there's a PHP Fatal error in httpd-error.log. With the exception of up=
loaded files, SuiteCRM _appears_ to work correctly otherwise.=20

There is discussion in the SuiteCRM forum regarding the same symptoms, but =
the solutions are to set file and directory permissions correctly (file not=
 uploading at all) and/or load the php fileinfo module (file mime type not =
recognised correctly), both of which I have confirmed are correct (even chm=
od -R 777 for testing, and fileinfo was already enabled and confirmed by ph=
pinfo). I'm not familiar with MIME types and implications, but verified mim=
e_module was enabled in httpd.conf (and even tried enabling mime_magic_modu=
le, to no effect).

I haven't tried spinning up an Ubuntu vm to positively confirm for myself, =
but so far as I can tell Linux users are successfully using SuiteCRM on sta=
ndard Linux AMP stacks, encountering only trivial errors during installatio=
n. If I do get try installing on Ubuntu, comparing Apache and PHP config (a=
nd build options) feels like searching for a needle in a haystack, and poss=
ibly a black hole of learning Linuxisms. Any suggestions?


Fwiw, here is the PHP Fatal error that occurs after saving a profile pictur=
e (I presume when the page is rendered with the new image):

[Tue Mar 01 08:13:13.132076 2022] [php:error] [pid 49638] [client 174.0.43.=
39:45460] PHP Fatal error:  Uncaught TypeError: in_array(): Argument #2 ($h=
aystack) must be of type array, null given in /usr/local/www/SuiteCRM-7.12.=
4/download.php:267\nStack trace:\n#0 /usr/local/www/SuiteCRM-7.12.4/downloa=
d.php(267): in_array()\n#1 /usr/local/www/SuiteCRM-7.12.4/include/MVC/Contr=
oller/SugarController.php(1017): require_once('...')\n#2 /usr/local/www/Sui=
teCRM-7.12.4/include/MVC/Controller/SugarController.php(465): SugarControll=
er->handleEntryPoint()\n#3 /usr/local/www/SuiteCRM-7.12.4/include/MVC/Contr=
oller/SugarController.php(361): SugarController->process()\n#4 /usr/local/w=
ww/SuiteCRM-7.12.4/include/MVC/SugarApplication.php(101): SugarController->=
execute()\n#5 /usr/local/www/SuiteCRM-7.12.4/index.php(52): SugarApplicatio=
n->execute()\n#6 {main}\n  thrown in /usr/local/www/SuiteCRM-7.12.4/downloa=
d.php on line 267, referer: https://suitecrm.dalescott.net/index.php?module=
=3DUsers&action=3DDetailView&record=3D1
dale@whizzer:/usr/local/etc/php %=20

and this is the offending line 267 in download.php

if (in_array($row['file_ext'], $sugar_config['allowed_preview'], true)) {
    $showPreview =3D isset($_REQUEST['preview']) && $_REQUEST['preview'] =
=3D=3D=3D 'yes' && $mime_type !=3D=3D 'text/html';
}


Best regards, and TIA :-)

Dale


---=20
Dale Scott=20
www.dalescott.net
https://ca.linkedin.com/in/dalescott



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?637715396.61990484.1646149769165.JavaMail.zimbra>