简体   繁体   English

无法在 MAMP 和 WAMP 上执行某些 php 文件

[英]Unable to execute some php files on MAMP & WAMP

I'm sorry in advance for being a noob我很抱歉我是菜鸟

So I started taking a php course the instructor told viewers to install mamp or xammp所以我开始参加 php 课程,讲师告诉观众安装 mamp 或 xammp
A quick google search said Wamp is better for windows so I went along with it, the problem I faced was that the php files I created were not being executed whereas the professor's php web application worked perfectly, I did everything correctly. A quick google search said Wamp is better for windows so I went along with it, the problem I faced was that the php files I created were not being executed whereas the professor's php web application worked perfectly, I did everything correctly. I created a text doc replaced txt with php extension and then wrote a simple code我创建了一个文本文档,用 php 扩展名替换了 txt,然后写了一个简单的代码

<?php> echo "hello world" ?>

This was not being executed, the server kept saying unable to handle this request .这没有被执行,服务器一直说unable to handle this request

So I uninstalled wamp and installed mamp, I deleted the original files from httdocs which were a simple index.php and jpg file.. I pasted two folders, one my professor's web application and the second being my practice lab.所以我卸载了 wamp 并安装了 mamp,我从 httdocs 中删除了原始文件,这些文件是一个简单的 index.php 和 jpg 文件。我粘贴了两个文件夹,一个是我教授的 web 应用程序,第二个是我的实践实验室。 And again it displayed the same regardless of the fact that I'm opening the file through the index directory无论我通过索引目录打开文件,它再次显示相同

I don't know what's the error.我不知道有什么错误。 Can anyone help me?谁能帮我?
I am trying to get this run for almost 3 hours我试图让这个运行近 3 个小时

As per the comments above...根据上面的评论...

Seems like it could be a 500 internal server error.似乎它可能是 500 内部服务器错误。 Try <?php echo "Hello world"; ?>试试<?php echo "Hello world"; ?> <?php echo "Hello world"; ?>

500 internal server errors are shown when your php code has fatal errors that can't be processed.当您的 php 代码出现无法处理的致命错误时,将显示 500 个内部服务器错误。

Your error come from opening and closing tag.您的错误来自开始和结束标签。

Based on PSR-1 It should be <?php and ?> but not <?php>基于PSR-1应该是<?php?>但不是<?php>

PHP code MUST use the long <?php?> tags or the short-echo <?=?> tags; PHP 代码必须使用长<?php?>标签或短回声<?=?>标签; it MUST NOT use the other tag variations.不得使用其他标签变体。

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

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