加载在Chrome中的PHP文件显示PHP codeS [英] Loading a PHP file in Chrome displays PHP codes

查看:389
本文介绍了加载在Chrome中的PHP文件显示PHP codeS的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

问题:结果
正是因为它说。我的phpinfo.php的文件包含以下内容:

The Problem:
Exactly as it says. My phpinfo.php file contains the following:

<?php phpinfo(); ?>

文件本身位于 /var/www/html/info.php

我做了什么(之前的问题):结果
我擦除PHP,OCI8的所有安装,并没有什么。我不知道如果我干得不错 - 基本上,我在百胜历史键入然后解开每一个安装与PHP

What I did (prior to the problem):
I erased all installations of PHP, oci8, and what not. I'm not sure if I did a good job - basically, I typed in yum history and then undid every install relating to PHP.

这是这样我就可以有一个干净的系统(据说),再次尝试所有的PHP的东西,而不是诉诸重新格式化之前 - 我的Oracle 11g和Apache已经设置有

This was so I could have a clean system (supposedly), before trying all the PHP stuff again, without resorting to a reformat - I had Oracle 11g and apache already setup there.

注意到,这个完整的区域覆盖前,说了的文件有工作的罚款。

Take note, before this complete wipeout, said file up there was working fine.

要与OCI8安装PHP,我也跟着指导的此处,具有一定的差异,但我将列出下来,一样的。

To install PHP with oci8, I followed a guide here, with some differences, but I'll list it down, just the same.


  • yum的安装PHP梨

  • yum的安装PHP-DEVEL

  • 梨下载PECL / OCI8

  • 焦油xvzf oci8-2.0.6.tgz

  • CD oci8-2.0.6

  • 运行phpize

  • ./配置--with-OCI8 = $ ORACLE_HOME


  • 请安装

  • setsebool -P httpd_execmem 1

后来,我加在 /etc/php.ini中文件最末尾以下内容:结果
[OCI8]结果
延长= oci8.so

Afterwards, I added the following at the very end of /etc/php.ini file:
[OCI8]
extension=oci8.so

然后,我通过服务的httpd重新启动重新启动Apache的。

Then, I restarted apache via service httpd restart.

然后,我遇到了这个问题。

And then, I encountered the problem.

的系统:


  • 的Fedora 19 x86_64的

  • 的Oracle 11g

  • 的Apache 2.4.6

我的尝试:结果
我开始还以为这是Konqueror中的问题。在查看设置摆弄有时固定它 - 大多数时候,它什么也没做。

What I tried:
I thought at first it was Konqueror's problem. Fiddling with the View settings sometimes fixed it - most of the time, it did nothing.

因此​​,我安装谷歌Chrome,它显示的是一样的。

So I installed Google Chrome, which displayed the same thing.

在这一点上,我去了,究竟发生了什么,我只是通过安装了PHP荫安装PHP 。也许 PHP梨 PHP-DEVEL 自身是不够的,运行一个PHP文件。

At this point I went, what the heck, I just installed php via yum install php. Maybe php-pear or php-devel on its own is not enough to run a php file.

没有骰子。所有我想要的是重新开始,并从头OCI8安装PHP。

No dice. All I wanted was to start over and install PHP with oci8 from scratch.

这似乎PHP本身有问题,我被困。研究有点在线说,一些有关的标签,在PHP不能运行&LT;&.... GT; ,而不是 &LT; PHP .....&GT; ,但你可以用我的phpinfo例子中看到,它并没有多大帮助。

It appears PHP itself has a problem, and I'm stuck. A bit of research online says something about the tags, that php can't run <?.... ?>, as opposed to <?php ..... ?>, but as you can see with my phpinfo example, it didn't help much.

其他信息:结果
我得到这个从PHP的错误日志。我不知道这是否意味着什么,因为我记得看到类似这样的东西回来之前,我核爆我的系统,但也许他们可以是一些使用的。

Other Information:
I get this from PHP's error log. I'm not sure if it means anything, as I recall seeing something like this back before I nuked my system, but perhaps they can be of some use.

AH01276:不能用作目录/ var / www / html等/:不匹配
  DirectoryIndex的(index.html的,的index.php)发现,并生成服务器
  由Options指令禁止目录索引

AH01276: Cannot serve directory /var/www/html/: No matching DirectoryIndex (index.html,index.php) found, and server-generated directory index forbidden by Options directive

AH00094:命令行:/ usr / sbin目录/的httpd -D前景

AH00094: Command line: '/usr/sbin/httpd -D FOREGROUND'

他们似乎并不出现在任何predictable频率错误日志 - 加载了任何PHP文件或重新启动Apache的是只有两件事情我已经做了

They don't seem to appear in the error log at any predictable frequency - loading up any PHP file or restarting apache are the only two things I've done.

推荐答案

这不是浏览器。也许,你没有在Apache激活PHP模块。看看你的httpd.conf文件,并把以下行有:

It's not the browser. Probably, you don't have php module activated in your Apache. Look at your httpd.conf, and put the following lines there:

# Load the PHP module:
LoadModule php5_module lib/httpd/modules/libphp5.so

# Tell Apache to feed all *.php files through PHP.  If you'd like to
# parse PHP embedded in files with different extensions, comment out
# these lines and see the example below.
<FilesMatch \.php$>
    SetHandler application/x-httpd-php
</FilesMatch>

这篇关于加载在Chrome中的PHP文件显示PHP codeS的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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