Re: file upload issues with SuiteCRM V7/8 (or apache24 and php8 diff FreeBSD vs Debian)
Date: Tue, 01 Mar 2022 16:47:05 UTC
On Tue, Mar 1, 2022 at 4:45 PM Waitman Gobble <gobble.wa@gmail.com> wrote: > > On Tue, Mar 1, 2022 at 3:50 PM Dale Scott <dalescott@shaw.ca> wrote: > > > > 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 PHP 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 (800x944 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 uploaded files, SuiteCRM _appears_ to work correctly otherwise. > > > > 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 chmod -R 777 for testing, and fileinfo was already enabled and confirmed by phpinfo). I'm not familiar with MIME types and implications, but verified mime_module was enabled in httpd.conf (and even tried enabling mime_magic_module, 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 standard Linux AMP stacks, encountering only trivial errors during installation. If I do get try installing on Ubuntu, comparing Apache and PHP config (and build options) feels like searching for a needle in a haystack, and possibly a black hole of learning Linuxisms. Any suggestions? > > > > > > Fwiw, here is the PHP Fatal error that occurs after saving a profile picture (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 ($haystack) 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/download.php(267): in_array()\n#1 /usr/local/www/SuiteCRM-7.12.4/include/MVC/Controller/SugarController.php(1017): require_once('...')\n#2 /usr/local/www/SuiteCRM-7.12.4/include/MVC/Controller/SugarController.php(465): SugarController->handleEntryPoint()\n#3 /usr/local/www/SuiteCRM-7.12.4/include/MVC/Controller/SugarController.php(361): SugarController->process()\n#4 /usr/local/www/SuiteCRM-7.12.4/include/MVC/SugarApplication.php(101): SugarController->execute()\n#5 /usr/local/www/SuiteCRM-7.12.4/index.php(52): SugarApplication->execute()\n#6 {main}\n thrown in /usr/local/www/SuiteCRM-7.12.4/download.php on line 267, referer: https://suitecrm.dalescott.net/index.php?module=Users&action=DetailView&record=1 > > dale@whizzer:/usr/local/etc/php % > > > > and this is the offending line 267 in download.php > > > > if (in_array($row['file_ext'], $sugar_config['allowed_preview'], true)) { > > $showPreview = isset($_REQUEST['preview']) && $_REQUEST['preview'] === 'yes' && $mime_type !== 'text/html'; > > } > > > > > > Best regards, and TIA :-) > > > > Dale > > > > > > --- > > Dale Scott > > www.dalescott.net > > https://ca.linkedin.com/in/dalescott > > > > There's no result from (i presume) db query . > > $row['file_ext'] is null. > > $row is typically used for a db result, but i haven't looked at the code. > Code execution probably should make it to this block if there's no > query result. > > I'll check out SugarCRM I don't think i've tried this one. > > > > > -- > Waitman Gobble oops, "Code execution probably *should not* make it to this block..." -- Waitman Gobble