简体   繁体   English

安装苗条框架时出现500个内部服务器错误

[英]500 internal server error on installing slim framework

i am developing a simple RESTful API on slim framework. 我正在苗条的框架上开发一个简单的RESTful API。 I had no problem installing the slim framework on my local wamp server and it works just fine, but as I do the same on my website I get an 500 internal server error. 我在本地wamp服务器上安装苗条框架没有问题,并且工作正常,但是在我的网站上执行相同操作时,出现500内部服务器错误。

My httaccess file 我的httaccess文件

RewriteEngine On 
RewriteBase /slim/
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php [QSA,L]
php_flag register_globals on

I need help, could someone please enlighten me on how to fix this problem? 我需要帮助,有人可以启发我如何解决此问题吗?

If your web host is a CPanel one (a pretty good chance), it's probably using SuPHP in which case any php_flag or php_value directives in .htaccess will trigger a 500 error. 如果您的虚拟主机是CPanel主机(很有可能),则可能使用SuPHP,在这种情况下, .htaccess任何php_flagphp_value指令都将触发500错误。

See http://blog.philipbrown.id.au/2009/08/php-suexec-and-custom-php-ini-files/ 参见http://blog.philipbrown.id.au/2009/08/php-suexec-and-custom-php-ini-files/

register_globals is a terrible hack and one you definitely should not be using. register_globals是一个可怕的hack,您绝对不应该使用。 If the framework requires it, choose a better framework. 如果框架需要它,请选择一个更好的框架。

Update 更新

The syntax on line #40 is using a PHP 5.3 anonymous function. 第40行的语法使用的是PHP 5.3匿名函数。 Your web host is probably using a lower PHP version. 您的虚拟主机可能使用较低的PHP版本。

See the advice under Step 3: Define Routes section on this page . 请参阅本页上“步骤3:定义路线”部分下的建议。

I encountered the same problem and I was able to correct this by uncommenting the following line in the file "httpd.conf" (apache conf) : 我遇到了同样的问题,并且可以通过取消注释文件“ httpd.conf”(apache conf)中的以下行来纠正此问题:

#LoadModule rewrite_module modules/mod_rewrite.so

Maybe this indication will help someone later ;) 也许这个指示以后会帮助别人的

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM