LAMP堆栈的PHP不工作(Ubuntu 13.10 / Apache 2.4.6)

发布时间:2022-04-30 发布网站:脚本宝典
脚本宝典收集整理的这篇文章主要介绍了LAMP堆栈的PHP不工作(Ubuntu 13.10 / Apache 2.4.6)脚本宝典觉得挺不错的,现在分享给大家,也给大家做个参考。
在我的LamP堆栈上遇到 PHP问题: PHP脚本根本没有被解析.我在清除机器上安装Ubuntu 13.10 …而且我现在看到,只有从页面清除HTML,但是PHP标签就像文本一样

其实我有什么

$/usr/sbin / apache2ctl status | greP版

Server Version: Apache/2.4.6 (ubuntu) PHP/5.5.3-1ubuntu2.1

$tail -n 1 /VAR/LOG/apache2/error.log

[Sat Dec 14 19:33:16.307184 2013] [core:notice] [pid 15457] AH00094: Command line: '/usr/sbin/apache2'

$apache2ctl -s

VirtualHost configuration:
*:80                   is a NameVirtualHost
         default server videosurgeon.ll (/etc/apache2/sITes-enabled/vs.conf:1)
         port 80 namevhost videosurgeon.ll (/etc/apache2/sites-enabled/vs.conf:1)
         port 80 namevhost videosurgeon.ll (/etc/apache2/sites-enabled/vs.conf:1)
ServerRoot: "/etc/apache2"
Main DocumentRoot: "/var/www"
Main ErrorLog: "/var/log/apache2/error.log"
Mutex default: dir="/var/lock/apache2" mechanism=fcntl 
Mutex mpm-accept: using_defaults
Mutex watchdog-callback: using_defaults
Mutex rewrite-map: using_defaults
PiDFile: "/var/run/apache2/apache2.pid"
define: DUMP_VHOSTS
Define: DUMP_RUN_CFG
User: name="www-data" id=33 not_used
Group: name="www-data" id=33 not_used

$apache2ctl -M | grep PHP

PHP5_module (shared)

$cat /work/VS/httpdocs/test.PHP

<? PHPinfo(); ?>

$cat /etc/apache2/sites-enabled/vs.conf

<VirtualHost *:80>
    ServerAdmin webmaster@localhost
    ServerName videosurgeon.ll

    DirectoryIndex index.PHP index.html index.htm

    DocumentRoot /work/VS/httpdocs/

    <Directory /work/VS/httpdocs/>
    Options FollowSymLinks MultiViews
    Allowoverride All
    Order allow,deny
    allow From all
    </Directory>

    ErrorLog /var/log/apache2/error.log

    # Possible values include: debug,info,notice,warn,error,crit,alert,emerg.
    LogLevel notice

    CustomLog /var/log/apache2/access.log combined
</virtualHost>

$/usr/bin/PHP –version

PHP 5.5.3-1ubuntu2.1 (cli) (built: Dec 12 2013 04:22:11) 
Copyright (c) 1997-2013 The PHP Group
Zend Engine v2.5.0,Copyright (c) 1998-2013 Zend Technologies
    with Zend Opcache v7.0.3-dev,Copyright (c) 1999-2013,by Zend Technologies

UPD.1:这是我的apache2.conf:http://ge.tt/6Yd8Jj91/v/0

UPD.2:今天我呃尝试删除所有的东西,只是重新安装LAMP.结果完全一样:PHP不起作用

sudo apt-get install lamp-server^

但也有趣的是,PHPmyadmin工作正常.我只是安装它:

sudo apt-get install PHP5 PHP5-cgi PHPmyadmin

原来,那里(在PHPmyadmin)是一些设置,使它使用PHP

只是有同样的问题.你必须使用<?PHP而不是<?或更改以下配置: /etc/PHP5/apache2/PHP.ini
; This directive determines whether or not PHP will recognize code between
; <? and ?> tags as PHP source which should be PRocessed as such. It's been
; recommended for several years that you not use the short tag "short cut" and
; instead to use the full <?PHP and ?> tag combination. With the wide spread use
; of XML and use of these tags by other languages,the server can become easily
; confused and end up parsing the wrong code in the wrong context. But because
; this short cut has been a feature for such a long time,it's currently still
; supported for backwards compatibility,but we recommend you don't use them.
; Default Value: On
; Development Value: Off
; Production Value: Off
; http://PHP.net/short-oPEn-tag
short_open_tag = On

脚本宝典总结

以上是脚本宝典为你收集整理的LAMP堆栈的PHP不工作(Ubuntu 13.10 / Apache 2.4.6)全部内容,希望文章能够帮你解决LAMP堆栈的PHP不工作(Ubuntu 13.10 / Apache 2.4.6)所遇到的问题。

如果觉得脚本宝典网站内容还不错,欢迎将脚本宝典推荐好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。