On Uptime hosting, PHP runs with the working directory set to your site's web root (document root). This behavior is intentional. It keeps file resolution predictable and consistent across requests on IIS and FastCGI.
Many older PHP applications assume the working directory matches the folder that contains the script being executed. That assumption often breaks on modern hosting stacks—and it is the most common cause of “file not found” errors after migrating a legacy site to Uptime.
Typical symptoms
include,require, orrequire_oncefailures for config or library files- Broken paths to uploads, caches, or log directories
- Code that uses bare relative strings such as
../config.phpor./includes/bootstrap.php
What to change
Stop anchoring paths to the process working directory. Instead, build paths from a known base:
- Any PHP file: use
__DIR__so paths are relative to the current source file.
Example:require __DIR__ . '/config/database.php'; - CodeIgniter 4 apps: use framework constants such as
FCPATH,APPPATH,ROOTPATH, andWRITEPATHinstead of hand-rolled relative strings. - Path normalization: in CodeIgniter 4, load the filesystem helper and use
set_realpath()to resolve local paths safely before reading or writing files.
Migration checklist
- Search your codebase for relative includes (
../,./) and paths built fromgetcwd(). - Replace them with
__DIR__-based paths or your framework's path constants. - Retest entry points (front controller, cron scripts, and upload handlers) after deployment.
- Keep writable directories outside the public web root whenever possible.
If you are unsure which pattern your application uses, open a chat or call support and mention the exact file path shown in the PHP error—we can point you to the correct base constant for your stack.