【问题标题】:How can I solve Server error! Error 500 when running app in xampp我该如何解决服务器错误!在 xampp 中运行应用程序时出现错误 500
【发布时间】:2025-12-02 06:25:01
【问题描述】:

我正在使用 codeigniter 框架开发一个网站。我将所有包粘贴到 phpdesktop,因为我们试图将其转换为运行良好的桌面应用程序。但是当我将文件夹移动到 xamp 中的 htdocs 时,它无法运行,出现以下错误:

服务器错误!

服务器遇到内部错误,无法完成 你的申请。服务器超载或出现错误 一个 CGI 脚本。

如果您认为这是服务器错误,请联系网站管理员。 错误 500 本地主机 Apache/2.4.39 (Win64) OpenSSL/1.1.1b PHP/7.3.5

当我检查 apache 错误日志时,我显示了这个:

[2019 年 5 月 10 日星期五 18:36:37.353885] [core:alert] [pid 14880:tid 1912]
[客户端 ::1:58528] C:/xampp/htdocs/law/.htaccess: 无效命令 '//',可能拼写错误或由未包含在 服务器配置

htaccess

RewriteEngine On

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ sys_info/$1 [L] 

我该如何解决。此外,它在 phpdesktop 中也能完美运行。

【问题讨论】:

    标签: codeigniter xampp


    【解决方案1】:

    您是否已经在config.php 上配置了您的index_page?如果您将其留空,这是一个适合我的 .htaccess 示例:

    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ index.php/$1 [L]
    
    </IfModule>
    

    希望这会有所帮助!

    【讨论】:

    • 再次检查文件C:\xampp\htdocs\law\.htaccess——它似乎有一些像// this is a comment这样的行,但它应该是# this is a comment
    最近更新 更多