为什么我在浏览器中看到PHP代码? [英] Why am I seeing the PHP code in the browser?

查看:280
本文介绍了为什么我在浏览器中看到PHP代码?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,


Actionscript / Javascript程序员PHP新手。

刚在我的MacBook上安装了MAMP - 没问题,一切正常。

也成功配置Dreamweaver与Apache / MySql一起使用(使用官方的Adobe指令) - 再次,没有问题。


我现在正在尝试运行一些非常基本的PHP页面 - 介绍/教程类型的东西 - 但它们不起作用:使用常规HTML生成的内容正确显示但是<?php>中的任何内容标签根本不显示。


此外,专门用于PHP的页面在浏览器上显示为文字代码。就像我在常规文本编辑器中查看它们一样。


显然,有些问题与PHP被错误解释有关 - 关于如何解决这个问题的任何想法?

Hi All,

Actionscript/Javascript programmer new to PHP.
Just installed MAMP on my MacBook - no problems, all works well.
Also successfully configured Dreamweaver to work with Apache/MySql (using official Adobe instructions)- again, no problems.

I''m now trying to run some very basic PHP pages - intro/tutorials type stuff - but they don''t work: content generated with regular HTML shows up correctly but anything in <?php> tags does not show up at all.

Also, pages that are exclusively in PHP show up as literal code on the browser. Its as if I was looking at them in a regular text-editor.

Obviously there''s some issues having to do with PHP being incorrectly interpreted - any ideas on how to fix this?

推荐答案

您的服务器没有将它们解析为PHP。你肯定有服务器在运行吗?使用正确扩展名(.php)的文件?你的错误日志(apache)怎么样 - 其中有什么东西?


Mark。
Your server isn''t parsing them as PHP. Sure you''ve got the server running? Files using correct extension (.php)? How about your error logs (apache) - anything in them?

Mark.


更多


- 你停止了Mac上的原生Apache

- 禁用时使用短标签(虽然你提到<?php?>)

- PHP模块未加载

- 未在Apache注册的php扩展
some more

- did you stop the native Apache on Mac
- using short tags when disabled (though you mentioned <?php ?>)
- PHP module not loaded
- php extention not registered in Apache


先生们,


回答你的问题,这里是我所知道的:

- MAMP应用程序为Apache和MySQL服务器启用了绿灯,我认为这意味着它们都正常运行

-I am确实在我的文件名中使用了正确的.php扩展名

-re Apache错误日志 - 你如何访问这些?

-re"你是否停止了原生Apache在Mac上? - 我不知道我已经跑了。我相信它附带OS 10.5,但我在10.4.11,所以我不认为我曾预装过 - 但这是正确的吗?我怎么才能找到?

-不使用短标签 - 至少我不认为我是。我知道我没有在任何地方启用它们...我基本上从在线教程中复制粘贴了一些非常的基本PHP代码,所以我很确定代码是正确的。

- 不知道PHP模块是否已加载 - 我该如何检查?

-在Apache中注册的PHP扩展的相应内容 - 我该如何检查?


谢谢: - )
Gentlemen,

In response to your questions, here''s what I know:
-the MAMP app has the green lights ON for both Apache and MySQL Servers which I take it means they''re both running correctly
-I am indeed using the correct .php extension in my file-names
-re Apache error-logs - how do you access these?
-re "did you stop native Apache on Mac?" - I don''t know that I already had it running. I believe it comes with OS 10.5 but I''m on 10.4.11 so I don''t think I ever had it pre-installed - but is this correct? How can I find out?
-Not using short-tags - at least I don''t think that I am. I know I didn''t enable them anywhere...I basically copy-pasted some very basic PHP code from online tutorials so I''m pretty sure the code is right.
-No idea if the PHP module is loaded or not - how do I check for this?
-Same thing for PHP extensions registered in Apache - how do I check for this?

thanks :-)


这篇关于为什么我在浏览器中看到PHP代码?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆