Home >Backend Development >PHP Tutorial >Why Does Anchor CMS 0.8 Throw a 'No Input File Specified' Error on a CGI Server?

Why Does Anchor CMS 0.8 Throw a 'No Input File Specified' Error on a CGI Server?

Barbara Streisand
Barbara StreisandOriginal
2024-11-10 11:01:02740browse

Why Does Anchor CMS 0.8 Throw a

Resolving the "No Input File Specified" Error in Anchor CMS

The "No input file specified" error encountered while upgrading Anchor CMS to version 0.8 stems from the PHP implementation on the server, particularly in a CGI environment.

To understand this error, it's crucial to grasp how your system handles URLs. According to the .htaccess file provided, your CMS expects the URL to be passed as a PATH_INFO variable. However, CGI implementations lack PATH_INFO, resulting in PHP returning the aforementioned error when attempting to pass the URI.

Exploring Solutions:

  1. Attempting to Fix the Issue:

    • Although possible, modifying PHP settings is unlikely to be permitted on shared hosting environments like GoDaddy.
  2. Alternative Approach:

    • System/uri.php relies on two types of URI detection: PATH_INFO and REQUEST_URI. As PATH_INFO is problematic in our case, we turn to REQUEST_URI.
    • However, directly passing the URI to REQUEST_URI leads to insufficient parsing by parse_url(), returning only the URL path.
    • Therefore, the only viable solution is to modify the CMS core.

Revised .htaccess and System/uri.php Modifications:

Modify system/uri.php:

  • Add QUERY_STRING as the first element to the array on line 40.

Modify .htaccess:

  • Change RewriteRule to pass the URI as a query string:

    RewriteRule ^(.*)$ index.php?/ [L]

This workaround allows the URI to be passed to index.php as QUERY_STRING, enabling the URI detection mechanism to locate it. However, it also necessitates maintaining modified core files until this issue is resolved.

Consider Alternative CMS Options:

If the aforementioned approach proves inadequate, it may be prudent to consider a more robust and reliable CMS that does not encounter such issues.

The above is the detailed content of Why Does Anchor CMS 0.8 Throw a 'No Input File Specified' Error on a CGI Server?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn