installer fails, if posix is not installed on linux systems #3317

Closed
opened 2026-02-20 16:03:46 -05:00 by deekerman · 3 comments
Owner

Originally created by @bjoern86 on GitHub (Sep 21, 2018).

installer fails on step 2 with this error:

Fatal error: Uncaught Error: Call to undefined function posix_getpwuid() in /SuiteCRM/include/utils.php:455 Stack trace: #0 /SuiteCRM/install/ready.php(284): getRunningUser() #1 /SuiteCRM/install.php(796): require('/html/SuiteCRM/...') #2 {main} thrown in /SuiteCRM/include/utils.php on line 455

This is because posix is not installed on an linux system with PHP-FPM up and running. The problem is, that there is only a check if the os is windows and if not, the script asumes, that posix is installed. We better check if posix is installed and not for windws in line 452:

if (!function_exists('posix_getpwuid')) {

instead of

if (is_windows()) {

this should be fixed in update scripts as well.

Originally created by @bjoern86 on GitHub (Sep 21, 2018). installer fails on step 2 with this error: Fatal error: Uncaught Error: Call to undefined function posix_getpwuid() in /SuiteCRM/include/utils.php:455 Stack trace: #0 /SuiteCRM/install/ready.php(284): getRunningUser() #1 /SuiteCRM/install.php(796): require('/html/SuiteCRM/...') #2 {main} thrown in /SuiteCRM/include/utils.php on line 455 This is because posix is not installed on an linux system with PHP-FPM up and running. The problem is, that there is only a check if the os is windows and if not, the script asumes, that posix is installed. We better check if posix is installed and not for windws in line 452: if (!function_exists('posix_getpwuid')) { instead of if (is_windows()) { this should be fixed in update scripts as well.
Author
Owner

@pgorod commented on GitHub (Sep 21, 2018):

Actually the script tries a few different methods and is ready to return a value even if none of them work.

https://github.com/salesagility/SuiteCRM/blob/master/include/utils.php#L445

But it seems on some systems, instead of simply returning NULL there, break the script execution with a FATAL. It would be interesting to know more about the specifics of your system.

Anyway, I've seen this happen a couple of times in the forums and I agree it would be better to make it more resilient.

But perhaps the correct way to do it is not replacing it on top of the is_windows test - it's simply wrapping the posix call inside a new if (!function_exists('posix_getpwuid')).

@pgorod commented on GitHub (Sep 21, 2018): Actually the script tries a few different methods and is ready to return a value even if none of them work. https://github.com/salesagility/SuiteCRM/blob/master/include/utils.php#L445 But it seems on some systems, instead of simply returning NULL there, break the script execution with a FATAL. It would be interesting to know more about the specifics of your system. Anyway, I've seen this happen a couple of times in the forums and I agree it would be better to make it more resilient. But perhaps the correct way to do it is not replacing it on top of the `is_windows` test - it's simply wrapping the posix call inside a new `if (!function_exists('posix_getpwuid'))`.
Author
Owner

@pgorod commented on GitHub (Sep 21, 2018):

Sorry, I hadn't refreshed the page when I wrote that comment - now I see you already provided a fix (and you made it like I said was better, cool). Thanks

@pgorod commented on GitHub (Sep 21, 2018): Sorry, I hadn't refreshed the page when I wrote that comment - now I see you already provided a fix (and you made it like I said was better, cool). Thanks
Author
Owner

@pgorod commented on GitHub (Jun 14, 2019):

New fix proposed in #7398 addressing all the issues raised by @gymad in comments on #6344

@pgorod commented on GitHub (Jun 14, 2019): New fix proposed in #7398 addressing all the issues raised by @gymad in comments on #6344
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/SuiteCRM-SuiteCRM#3317
No description provided.