gpt4 book ai didi

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

转载 作者:可可西里 更新时间:2023-11-01 12:32:43 26 4
gpt4 key购买 nike

我的 LAMP 堆栈上的 PHP 有问题:根本没有解析 PHP 脚本。我在干净的机器上安装了 Ubuntu 13.10...我现在看到页面上只有清晰的 HTML,但 PHP 标签就像文本一样

其实我有:

$/usr/sbin/apache2ctl 状态 | 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

关于php - LAMP 堆栈的 PHP 不工作 (Ubuntu 13.10/Apache 2.4.6),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20586671/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com