Quantcast
Channel: Joomla! Forum - community, help and support
Viewing all articles
Browse latest Browse all 1741

General Questions/New to Joomla! 5.x • Re: User login very slow

$
0
0
Hmm. So you don't know how to create a "correctly configured" server? It may well be that your installation is using a bodge. I can fix the issue using an auto_prepend_file that removes SCRIPT_NAME. But that is not a proper solution. I would raise this as an issue, but the text is rejected and I cannot see any fault in it.

# Routing Inconsistency Between mod-php and PHP-FPM Deployments

## Issue Summary
Joomla's routing logic behaves differently between mod-php and PHP-FPM deployments when live_site is not set, due to differences in how SCRIPT_NAME is populated in these environments. This affects sites installed in the document root and creates issues for modern PHP deployments.

## Technical Details

### Current Behavior
1. When live_site is empty, Joomla falls back to using SCRIPT_NAME for routing decisions
2. Under mod-php with Apache:
- For a request to example.com/heading/article
- SCRIPT_NAME is empty when the script is in document root
- Joomla's routing works as expected
3. Under PHP-FPM:
- For the same request to example.com/heading/article
- SCRIPT_NAME contains /heading/article
- This causes Joomla to incorrectly handle the request, resulting in 404 errors

### Why This Matters
1. PHP-FPM is increasingly the recommended deployment pattern because it:
- Provides better resource isolation
- Enables better security through process separation
- Offers superior performance for most workloads
- Is the default in many modern hosting environments

2. This isn't a server misconfiguration:
- The different SCRIPT_NAME behavior is inherent to how PHP-FPM processes requests
- Both behaviors are valid according to the CGI/FastCGI specifications
- Modifying this at the server level can break other applications

## Impact
- Sites moving from mod-php to PHP-FPM deployments experience unexpected 404 errors
- Workarounds require either:
- Server-level configuration changes that may affect other applications
- Setting live_site (which has been said to have issues with upgrades and is frequently denigrated)
- Using auto_prepend_file to modify server variables (a hack that shouldn't be necessary)

## Proposed Solutions

### Short-term
1. Document the issue and current workarounds
2. Add detection for PHP-FPM environments and adjust routing logic accordingly

### Long-term
1. Move away from relying on SCRIPT_NAME for routing decisions
2. Consider using more reliable server variables:
- REQUEST_URI (more consistent across deployments)
- SCRIPT_FILENAME (more reliable for determining script location)
3. Implement environment-aware routing that handles both mod-php and PHP-FPM patterns

## Testing Steps
To reproduce:
1. Fresh Joomla 5.2.2 installation in document root
2. PHP-FPM configuration (standard installation)
3. Access any SEF URL (for example /heading/article)
4. Observe 404 error
5. Set live_site or switch to mod-php - issue resolves

## Additional Notes
- This affects all recent Joomla versions
- The issue becomes more prevalent as hosts move to PHP-FPM
- Similar issues have been observed in other PHP applications that assume mod-php behavior

Statistics: Posted by counterpoint — Sun Dec 08, 2024 6:36 am



Viewing all articles
Browse latest Browse all 1741

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>