Moving a legacy CodeIgniter 4 application from a Windows IIS environment to a modern OpenLiteSpeed stack can dramatically improve performance, lower hosting costs, and simplify deployment workflows.
Migration is defined as the systematic process of transferring an application’s code, configuration, and dependencies from one hosting platform to another while preserving functionality.
Why Move from IIS to OpenLiteSpeed
OpenLiteSpeed offers built‑in HTTP/2 support, event‑driven architecture, and superior PHP handling compared with IIS. These features translate into faster page loads for the 19‑page numerology reports and lower CPU usage on typical shared‑hosting plans.
Preparing the CodeIgniter 4 Project for Linux
Before copying files, ensure the codebase follows Linux‑friendly conventions:
- File permissions: Set the
writable/directories (cache, logs, session) to755for directories and644for files, granting the web‑user write access. - Path separators: Replace any hard‑coded Windows paths (e.g.,
C:\\path\\to\\file) with relative paths usingBASEPATHorFCPATH. - Environment variables: Move secret keys and database credentials to a
.envfile and avoid committing them to version control.
Configuring OpenLiteSpeed and CyberPanel
Once the project is ready, follow these steps on the new Linux server:
- Install CyberPanel with OpenLiteSpeed (the installer handles dependencies).
- Create a new website in CyberPanel and set the document root to the
public/folder of your CodeIgniter project. - In the OpenLiteSpeed admin console, enable the LSAPI PHP handler and select the PHP version compatible with CodeIgniter 4 (PHP 8.2 or newer).
- Add a rewrite rule to route all requests to
index.php:RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^(.*)$ index.php/$1 [L] - Restart OpenLiteSpeed to apply the changes.
Testing and Optimizing the Deployed Application
After the server is configured, perform a thorough sanity check:
- Functional test: Submit a sample birth date and name to verify the 19‑page PDF is generated without errors.
- Performance test: Use a tool like
aborwrkto compare response times against the old IIS setup. - Log review: Check OpenLiteSpeed error logs for missing extensions or permission issues.
Fine‑tune caching settings in OpenLiteSpeed (e.g., enable Cache Policy for static assets) to further reduce load times.
Common Pitfalls and How to Avoid Them
Even a straightforward copy‑paste migration can stumble on a few hidden traps:
- Case‑sensitive file names: Linux differentiates
Config.phpfromconfig.php. Verify all includes match the exact case. - Missing PHP extensions: Ensure extensions like
intlandmbstringare installed, as CodeIgniter relies on them for localization and string handling. - Incorrect .htaccess conversion: IIS uses
web.configwhile OpenLiteSpeed reads.htaccess. Translate rewrite rules accordingly.
Frequently Asked Questions
Can I keep the same domain name after migration?
Yes. Update the DNS A record to point to the new server’s IP address, and the OpenLiteSpeed virtual host will serve the existing domain.
Do I need to modify the CodeIgniter 4 .env file?
Adjust database credentials, base URL, and any environment‑specific flags. The rest of the configuration can remain unchanged.
What PHP version is recommended for CodeIgniter 4 on OpenLiteSpeed?
PHP 8.2 or newer is recommended to leverage performance improvements and full compatibility with the framework.
Is SSL configuration different on OpenLiteSpeed?
OpenLiteSpeed provides a built‑in SSL manager. Upload your certificate and private key, then enable HTTPS in the virtual host settings.
How do I handle scheduled tasks (cron jobs) after migration?
Create a cron entry on the Linux server that calls the CodeIgniter CLI command, e.g., php /path/to/public/index.php schedule:run.
Neptune Infotech can help you plan and execute smooth migrations, ensuring your legacy applications run faster and more securely on modern Linux stacks.