@gsmela I'm not going through any "gyrations". If you think the requirement for a value for live_site is caused by a misconfigured server, then please state in what respect you think it is misconfigured? Using PHP-FPM is not misconfiguration. Have you done a test using PHP-FPM? Have you read through the Joomla code? I have done that, and set up test systems, and implemented all the things that people claimed would affect the result - none did. It is absurd for people to talk about "misconfigured servers" when there is no specification for a "correctly" configured server.
The problem is that Joomla tries to find the path to the site (in effect the subdirectory, if any). It uses the PHP globals $_SERVER['PHP_SELF'] and $_SERVER['SCRIPT_NAME']. But with PHP-FPM, a reference to e.g. https://example.com/up-users/Users has both those globals set to "/up-users/Users". Joomla removes one directory level and sets the path to "/up-users".
But this is incorrect. The site is not in a subdirectory at all (neither up-users nor anything else) and the path should be empty. Because Joomla has decided there is a path, all links have "/up-users" inserted into them. They are then invalid, resulting in 404 errors.
I actually specified this problem precisely on joomla.stackexchange.com but presumably because it went unanswered, the post has been hidden. It read as follows:
I've spent a good few hours ploughing through code and setting up servers to test exactly what is goes on to cause Joomla to fail in PHP-FPM unless $live_site is correctly set.
The problem turns out to be that when $live_site is empty, Joomla will in most cases rely on the value of the PHP super global $_SERVER['SCRIPT_NAME']. In the case of a site that is installed into the document root, this will be empty when PHP is running as an Apache module, even when the URL is something like https://example.com/heading/article. (Because the actual script is the index.php in the document root).
However, if PHP is running as PHP-FPM (which is a favoured solution for high performance and for site security) then the super global will contain "/heading/article" for the example above. With this value, Joomla does not work out how to handle the request and gives a 404 error.
This can obviously be fixed by hacking Joomla, but that isn't a good solution. Is there any way to make PHP-FPM behave in the same way as PHP as an Apache module? Unless a solution is available, my feeling is that Joomla should continue to support the use of $live_site and fix problems that occur when it is set (notably in Joomla upgrades).
The problem is that Joomla tries to find the path to the site (in effect the subdirectory, if any). It uses the PHP globals $_SERVER['PHP_SELF'] and $_SERVER['SCRIPT_NAME']. But with PHP-FPM, a reference to e.g. https://example.com/up-users/Users has both those globals set to "/up-users/Users". Joomla removes one directory level and sets the path to "/up-users".
But this is incorrect. The site is not in a subdirectory at all (neither up-users nor anything else) and the path should be empty. Because Joomla has decided there is a path, all links have "/up-users" inserted into them. They are then invalid, resulting in 404 errors.
I actually specified this problem precisely on joomla.stackexchange.com but presumably because it went unanswered, the post has been hidden. It read as follows:
I've spent a good few hours ploughing through code and setting up servers to test exactly what is goes on to cause Joomla to fail in PHP-FPM unless $live_site is correctly set.
The problem turns out to be that when $live_site is empty, Joomla will in most cases rely on the value of the PHP super global $_SERVER['SCRIPT_NAME']. In the case of a site that is installed into the document root, this will be empty when PHP is running as an Apache module, even when the URL is something like https://example.com/heading/article. (Because the actual script is the index.php in the document root).
However, if PHP is running as PHP-FPM (which is a favoured solution for high performance and for site security) then the super global will contain "/heading/article" for the example above. With this value, Joomla does not work out how to handle the request and gives a 404 error.
This can obviously be fixed by hacking Joomla, but that isn't a good solution. Is there any way to make PHP-FPM behave in the same way as PHP as an Apache module? Unless a solution is available, my feeling is that Joomla should continue to support the use of $live_site and fix problems that occur when it is set (notably in Joomla upgrades).
Statistics: Posted by counterpoint — Wed Nov 27, 2024 3:05 pm