Laravel和Mamp Localhost错误500 Mac

因此,在全新安装laravel(v5.4)并使用Mamp作为我的本地服务器后,我得到了(在 chrome)</ p>

  localhost页面无法正常工作

本地主机目前无法处理此请求。

打字机错误500
</ code> </ pre> \ n

我尝试了无数的事情,例如更改存储权限或laravel目录中的所有内容。</ p>

在目录中完成编辑器更新/安装。</ p>

我在Mac上运行PHP v7.0.12(10.11.6)。 不能想到会造成这种情况的其他任何事情吗?</ p>

如果我创建另一个目录,其中一个简单的index.php带''它加载得非常好,那么什么导致了laravel的问题? / p>

这是我的mamp设置的图片</ p>

http://i.imgur.com/xT3mMZO.png


http://i.imgur.com/ddz9uij.png </ p>
</ div>

展开原文

原文

So after a fresh install of laravel (v5.4) and using Mamp as my local server I just get (in chrome)

The localhost page isn’t working

localhost is currently unable to handle this request.
HTTP ERROR 500

I've tried countless things like changing permissions on storage or everything within the laravel directory.

Done composer update/install in the directory.

I'm running PHP v7.0.12 on my Mac (10.11.6). Cant think of anything else that would be causing this?

If I create another directory which a simple index.php with '' it loads absolutely fine so what is causing an issue with laravel?

Here's pics of my mamp setup

http://i.imgur.com/xT3mMZO.png
http://i.imgur.com/ddz9uij.png

douzhu7507
douzhu7507 你在基本目录中运行了composerinstall吗?
3 年多之前 回复
doucan2102
doucan2102 添加了原始帖子中mamp配置截图的链接
3 年多之前 回复
dongshen7407
dongshen7407 你的apache配置是什么?
3 年多之前 回复
doulan0297
doulan0297 据我所知,我应该通过localhost访问它:8888(mamp打开localhost的起始页面:8888/MAMP/?language=English)。我已将服务器的目录设置为laravel/public,因此不需要通过/public访问
3 年多之前 回复
du4822
du4822 检查storage/log/laravel.log文件。它将提供有关错误的更多信息。
3 年多之前 回复
dpgbh20688
dpgbh20688 你使用的是正确的网址吗?Laravel请求始终在公用文件夹中启动。因此,如果您在localhost的公用文件夹中安装了Laravel实例,则需要通过localhost/public访问它
3 年多之前 回复

2个回答



打开终端并输入:</ p>

  tail -n 20 / Applications / MAMP  /logs/php_error.log

nn

这可能会给你一些关于发生了什么的线索。</ p>

希望这会有所帮助 ,快乐的编码:)</ p>
</ div>

展开原文

原文

Open up terminal and type:

tail -n 20 /Applications/MAMP/logs/php_error.log

This may give you some clue as to what is going on.

Hope this helps, happy coding :)

doubu7425
doubu7425 所以在我的.bash_profile中我导出了PATH = / Applications / MAMP / bin / php / php5.6.27 / bin:$ PATH,我运行source~ / .bash_profile并显示正确的版本(5.6.27)。 如果我退出终端并重新打开并执行php -v它会给我5.5.36。 为什么这不节约?
3 年多之前 回复
duanjianxi8439
duanjianxi8439 想想我已经设法让它现在起作用。 管理得到PHP 5.6.30与PHP -v但我确实需要做一个全新安装的laravel后出现作曲家安装。 编辑:说谎,关闭终端,重新加载,PHP的版本已经变回5.5.36,最新情况如何?
3 年多之前 回复
dsfdfd1211
dsfdfd1211 您可以从mamp.info/en/downloads \下载所需的版本。此外,Mamp只允许显示2个版本的php。 快速修复,重命名你不喜欢使用的文件夹,对我来说,这意味着在我的/Applications/MAMP/bin/php/php5.4.10_X文件夹中添加一个“X”。 现在你的当前版本和7.0.0出现在mamp prefs中。 完成!
3 年多之前 回复
duanjiong5686
duanjiong5686 出现PHP版本现在依赖于目录不断更改,我的laravel目录中的版本给了我5.5.36。 如何在全球范围内将此版本更改为7?
3 年多之前 回复
du248227
du248227 运行此命令composer update --no-scripts
3 年多之前 回复
duanpan3166
duanpan3166 这就是我得到的(记得我做了全新安装?) - pastebin.com/wVC8NJjC
3 年多之前 回复

I just joined stackoverflow yesterday so I do not have enough reputation to comment. I write an answer here.

here is the short answer:

run :

PHP_VERSION=`ls /Applications/MAMP/bin/php/ | sort -n | tail -1`
echo "export PATH=/Applications/MAMP/bin/php/${PHP_VERSION}/bin:$PATH" >> .bash_profile
source ~/.bash_profile

check your php version by running php -v. close the terminal. Open another terminal and check php version again.if you see php 5 again then there are 2 possibilities: First: you added the /path/to/php7 after /path/to/php5 and php 5 is loaded first. Second: system loads another bash file first which your php 5 path is mentioned in it. I know that this sounds confusing having several bash file but it is. Please search for other files like bashrc or similars.

This is the long answer for anyone else:

first of all, if you are on mac, I highly suggest you to use valet to get rid of all these things.

But regarding the problem:

As you already noted that it is not a laravel issue. the php version that your machine uses is under the min required version by laravel. You have 2 versions of php at the moment. MacOs is shipped with php installed on that. I think it is the same php 5.5.36 that is making problem for you. Since Laravel 5.4, you need to use PHP >= 5.6.4. Although you have installed parallel php 7 on your machine, you need also to check which php your machine is reading from by running which php. after that remember to add your path to php 7 installed to bash_profile or other bash files on your mac(you can have 4 or 5 bash files). Considering you have only one bash file named as bash_profile and you are going to export the path to your php 7 to bash profile, If you run following command, that appends the path to the end of file

PHP_VERSION=`ls /Applications/MAMP/bin/php/ | sort -n | tail -1`
echo "export PATH=/Applications/MAMP/bin/php/${PHP_VERSION}/bin:$PATH" >> .bash_profile

remember to use source ~/.bash_profile in order to make changes effected. Alternatively you can open the bash_profile file in your text editor by running:

open -a /Applications/TextEdit.app ~/.bash_profile

and add the path manually before the /path/to/php5 path.

finally you must check your php version by running php -v. close the terminal. Open another terminal and check php version again. If you see php 7 then you are all fine. But if you see php 5 again then there are 2 possibilities: First: you added the /path/to/php7 after /path/to/php5 and php 5 is loaded first. Second: system loads another bash file first which your php 5 path is mentioned in it. I know that this sounds confusing having several bash file but it is. Please search for other files like bashrc or similars.

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
立即提问
相关内容推荐