[英]Server error slim framework php
I have a problem with Slim framework.I tried to display hello world on screen but it gives me the error: 我有Slim framework的问题。我试图在屏幕上显示hello world但是它给了我错误:
Server run an intern error and couldn't resolve your request.The server is overloaded or it was an error in a script CGI.
Error 500
My index.php 我的index.php
<?php
require __DIR__ . '/vendor/autoload.php';
$app = new \Slim\Slim();
$app->get('/hello', function () {
echo "Hello";
});
$app->run(); ?>
and my .htaccess 和我的.htaccess
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-F
RewriterULE ^ index.php [QSA, L]
I also modify in httpd.conf with the lines: 我还在httpd.conf中用以下行修改:
<Directory />
Options All
AllowOverride All
</Directory>
So when I write http://localhost/monologTree/hello it gives me the error from the start. 所以当我写http:// localhost / monologTree / hello时,它从一开始就给出了错误。 Any suggestions?
有什么建议么? Thank you
谢谢
Check your composer.json file. 检查您的composer.json文件。 I think you have installed slim 3. Then Try to instantiate slim like this
我认为你已经安装了苗条3.然后试着像这样实例化苗条
require 'vendor/autoload.php';
$app = new Slim\App();
Check this example for properly use Slim from installation. 检查此示例以正确使用Slim from installation。
The 2nd solution is Find the file called httpd.conf, it should be located in **XAMPPInstallDirectory\\apache\\conf** 第二个解决方案是查找名为httpd.conf的文件,它应该位于** XAMPPInstallDirectory \\ apache \\ conf **中
Open with notepad and find this line 用记事本打开并找到这一行
#LoadModule rewrite_module modules/mod_rewrite.so
Remove the # , save it, restart apache (if running). 删除# ,保存,重启apache(如果正在运行)。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.