lxw_wf 发表于 2012-05-15 10:22

web浏览php为纯文本

学着搭建apache+php52+php52-extension+zendoptimizer

文件名:index.php

内容:

<?php

phpinfo();

?>

结果:在网页浏览仍然是这段代码纯文本的内容。


网上所说的结果是:
This program makes use of the Zend Scripting Language Engine:   
Zend Engine v2.2.0, Copyright (c) 1998-2009 Zend Technologies   
with Zend Extension Manager v1.2.0, Copyright (c) 2003-2007, by Zend Technologies   
with Zend Optimizer v3.3.0, Copyright (c) 1998-2007, by Zend Technologies



与之相关的得文件已经安装

wangbadan# pkg_info | grep php
php52-5.2.17      PHP Scripting Language
php52-ctype-5.2.17The ctype shared extension for php
php52-dom-5.2.17    The dom shared extension for php
php52-extensions-1.3_1 A "meta-port" to install PHP extensions
php52-filter-5.2.17 The filter shared extension for php
php52-hash-5.2.17   The hash shared extension for php
php52-iconv-5.2.17The iconv shared extension for php
php52-json-5.2.17   The json shared extension for php
php52-pcre-5.2.17   The pcre shared extension for php
php52-pdo-5.2.17    The pdo shared extension for php
php52-pdo_sqlite-5.2.17 The pdo_sqlite shared extension for php
php52-posix-5.2.17The posix shared extension for php
php52-session-5.2.17 The session shared extension for php
php52-simplexml-5.2.17 The simplexml shared extension for php
php52-spl-5.2.17    The spl shared extension for php
php52-sqlite-5.2.17 The sqlite shared extension for php
php52-tokenizer-5.2.17 The tokenizer shared extension for php
php52-xml-5.2.17    The xml shared extension for php
php52-xmlreader-5.2.17 The xmlreader shared extension for php
php52-xmlwriter-5.2.17 The xmlwriter shared extension for php





请问我哪里做的不对呢,谢谢?

a.a 发表于 2012-05-15 11:52

apache 里面 addType 加了?

lxw_wf 发表于 2012-05-15 14:05

<Ifmodule>
加了
<Ifmodule>
并且我在/usr/local/libexec/apache22/下找不到libphp5.so
我已经选择了“APACHEBuild Apache Module”选项并进行了安装
回复 2# a.a


   

a.a 发表于 2012-05-15 15:40

php test.php 可以出结果的话。
那可能就是php 模块没有编译出来,一般来说使用系统管理工具安装不怎么会有问题。
你试试从源代码安装一下呢?

johnsonshu 发表于 2012-05-15 20:49

1. 看看apache的error log
2. 换一个教程
感觉还是addType 没有配置正确

hq22 发表于 2012-05-16 08:54

那是apache没配置好,没加载php阿

pitonas 发表于 2012-05-16 09:43

堪称经典啊:victory::victory:

jdbknhm19 发表于 2012-05-24 00:16

php.ini
试试html_errors=On

ulovko 发表于 2012-05-25 09:17

AddType application/x-httpd-php .php         (让apache 能执行php)
AddType application/x-httpd-php-source .phps
AddType application/x-compress .Z
AddType application/x-gzip .gz .tgz

hbeimf 发表于 2012-05-25 09:50

服务器没配好吧,
页: [1] 2
查看完整版本: web浏览php为纯文本