使用任何Jquery AJAX请求加载PHP脚本导致脚本返回而不是由服务器运行

时间:2015-01-03 23:38:20

标签: php jquery ajax apache xampp

我使用以下代码:

            $.post( "includes/modules/list.php" );

我尝试了以下内容:

            jQuery("#empty").load("/includes/modules/list.php", {}, function() { 
                refreshlist();
            }); 

            $.post("/includes/modules/list.php",function(data){
                alert(data);
            });

它在 IIS 上工作正常,但在切换到 Apache 后(我认为它实际上可以正常工作)它停止工作。
现在 IIS 服务器是由 Plesk 配置的,所以这可能与它有关吗?

这是我在这里发表的第一篇文章,请原谅我的任何错误。

编辑:我是用XAMPP做的,这意味着PHP与它捆绑在一起。 PHP脚本确实可以工作,我测试了hello world的东西并且它们都可以工作,但是当我尝试调用它时,它将无法正常工作。

我正在使用Windows。我正在认真辩论只是在ASP.NET中重写这个并安装回IIS但这已经花了这么多时间。这是一个个人项目,但我确实希望能够使用PHP,因为这是最主流的选择。

另一个编辑:这是我所要求的php -i转储(因为我不知道在哪里看)

SimpleXML

Simplexml support => enabled
Revision => $Id: a915862ec47f9589309acc4996ca8f6179788746 $
Schema support => enabled

soap

Soap Client => enabled
Soap Server => enabled

Directive => Local Value => Master Value
soap.wsdl_cache => 1 => 1
soap.wsdl_cache_dir => /tmp => /tmp
soap.wsdl_cache_enabled => 1 => 1
soap.wsdl_cache_limit => 5 => 5
soap.wsdl_cache_ttl => 86400 => 86400

sockets

Sockets Support => enabled

SPL

SPL support => enabled
Interfaces => Countable, OuterIterator, RecursiveIterator, SeekableIterator, Spl
Observer, SplSubject
Classes => AppendIterator, ArrayIterator, ArrayObject, BadFunctionCallException,
 BadMethodCallException, CachingIterator, CallbackFilterIterator, DirectoryItera
tor, DomainException, EmptyIterator, FilesystemIterator, FilterIterator, GlobIte
rator, InfiniteIterator, InvalidArgumentException, IteratorIterator, LengthExcep
tion, LimitIterator, LogicException, MultipleIterator, NoRewindIterator, OutOfBo
undsException, OutOfRangeException, OverflowException, ParentIterator, RangeExce
ption, RecursiveArrayIterator, RecursiveCachingIterator, RecursiveCallbackFilter
Iterator, RecursiveDirectoryIterator, RecursiveFilterIterator, RecursiveIterator
Iterator, RecursiveRegexIterator, RecursiveTreeIterator, RegexIterator, RuntimeE
xception, SplDoublyLinkedList, SplFileInfo, SplFileObject, SplFixedArray, SplHea
p, SplMinHeap, SplMaxHeap, SplObjectStorage, SplPriorityQueue, SplQueue, SplStac
k, SplTempFileObject, UnderflowException, UnexpectedValueException

sqlite3

SQLite3 support => enabled
SQLite3 module version => 0.7-dev
SQLite Library => 3.8.4.3

Directive => Local Value => Master Value
sqlite3.extension_dir => no value => no value

standard

Dynamic Library Support => enabled
Path to sendmail => C:\xampp\mailtodisk\mailtodisk.exe

Directive => Local Value => Master Value
assert.active => 1 => 1
assert.bail => 0 => 0
assert.callback => no value => no value
assert.quiet_eval => 0 => 0
assert.warning => 1 => 1
auto_detect_line_endings => 0 => 0
default_socket_timeout => 60 => 60
from => no value => no value
url_rewriter.tags => a=href,area=href,frame=src,input=src,form=fakeentry => a=hr
ef,area=href,frame=src,input=src,form=fakeentry
user_agent => no value => no value

tokenizer

Tokenizer Support => enabled

wddx

WDDX Support => enabled
WDDX Session Serializer => enabled

xml

XML Support => active
XML Namespace Support => active
libxml2 Version => 2.9.1

xmlreader

XMLReader => enabled

xmlrpc

core library version => xmlrpc-epi v. 0.51
php extension version => 0.51
author => Dan Libby
homepage => http://xmlrpc-epi.sourceforge.net
open sourced by => Epinions.com

xmlwriter

XMLWriter => enabled

xsl

XSL => enabled
libxslt Version => 1.1.27
libxslt compiled against libxml Version => 2.7.8
EXSLT => enabled
libexslt Version => 0.8.16

zip

Zip => enabled
Extension Version => $Id: a9db166c839b24cbebccad95120bd535e720038f $
Zip version => 1.12.4
Libzip version => 0.11.2

zlib

ZLib Support => enabled
Stream Wrapper => compress.zlib://
Stream Filter => zlib.inflate, zlib.deflate
Compiled Version => 1.2.7.3
Linked Version => 1.2.7.3

Directive => Local Value => Master Value
zlib.output_compression => Off => Off
zlib.output_compression_level => -1 => -1
zlib.output_handler => no value => no value

Additional Modules

Module Name

Environment

Variable => Value
ALLUSERSPROFILE => C:\ProgramData
AMDAPPSDKROOT => C:\Program Files (x86)\AMD APP\
APPDATA => C:\Users\Xilence\AppData\Roaming
asl.log => Destination=file
CommonProgramFiles => C:\Program Files (x86)\Common Files
CommonProgramFiles(x86) => C:\Program Files (x86)\Common Files
CommonProgramW6432 => C:\Program Files\Common Files
COMPUTERNAME => AURORA51
ComSpec => C:\Windows\system32\cmd.exe
FP_NO_HOST_CHECK => NO
GPU_MAX_ALLOC_PERCENT => 50
HOMEDRIVE => C:
HOMEPATH => \Users\Xilence
HuluDesktopPath => C:\Users\Xilence\AppData\Local\HuluDesktop\instances\0.9.14.1
\HuluDesktop.exe
LOCALAPPDATA => C:\Users\Xilence\AppData\Local
LOGONSERVER => \\AURORA51
MIBDIRS => C:/xampp/php/extras/mibs
MYSQL_HOME => C:\xampp\mysql\bin
NUMBER_OF_PROCESSORS => 4
OPENSSL_CONF => C:/xampp/apache/bin/openssl.cnf
OS => Windows_NT
Path => ;C:\xampp\;C:\xampp\php;C:\xampp\perl\site\bin;C:\xampp\perl\bin;C:\xamp
p\apache\bin;C:\xampp\mysql\bin;C:\xampp\FileZillaFTP;C:\xampp\MercuryMail;C:\xa
mpp\sendmail;C:\xampp\webalizer;C:\xampp\tomcat\bin;C:\Program Files (x86)\iis e
xpress\PHP\v5.6;C:\ProgramData\Oracle\Java\javapath;C:\Program Files (x86)\AMD A
PP\bin\x86_64;C:\Program Files (x86)\AMD APP\bin\x86;C:\zpanel\bin\apache\bin;C:
\zpanel\bin\mysql\bin;C:\zpanel\bin\php;C:\zpanel\bin\wget;C:\zpanel\bin\bind\bi
n;C:\Program Files\Common Files\Microsoft Shared\Windows Live;C:\Program Files (
x86)\Common Files\Microsoft Shared\Windows Live;C:\Program Files (x86)\NVIDIA Co
rporation\PhysX\Common;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C
:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\ATI Technologi
es\ATI.ACE\Core-Static;C:\Program Files\Perforce;C:\Program Files (x86)\Windows
Live\Shared;C:\Program Files\Perforce\Server;C:\Program Files\Microsoft\Web Plat
form Installer\;;C:\Program Files\Perforce\Server
PATHEXT => .COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC
PHPRC => C:\xampp\php
PHP_PEAR_BIN_DIR => C:\xampp\php
PHP_PEAR_CFG_DIR => C:\xampp\php\cfg
PHP_PEAR_DATA_DIR => C:\xampp\php\data
PHP_PEAR_DOC_DIR => C:\xampp\php\docs
PHP_PEAR_INSTALL_DIR => C:\xampp\php\pear
PHP_PEAR_PHP_BIN => C:\xampp\php\php.exe
PHP_PEAR_SYSCONF_DIR => C:\xampp\php
PHP_PEAR_TEST_DIR => C:\xampp\php\tests
PHP_PEAR_WWW_DIR => C:\xampp\php\www
PROCESSOR_ARCHITECTURE => x86
PROCESSOR_ARCHITEW6432 => AMD64
PROCESSOR_IDENTIFIER => AMD64 Family 16 Model 4 Stepping 3, AuthenticAMD
PROCESSOR_LEVEL => 16
PROCESSOR_REVISION => 0403
ProgramData => C:\ProgramData
ProgramFiles => C:\Program Files (x86)
ProgramFiles(x86) => C:\Program Files (x86)
ProgramW6432 => C:\Program Files
PROMPT => Xilence@AURORA51$S$P$_#$S
PSModulePath => C:\Windows\system32\WindowsPowerShell\v1.0\Modules\
PUBLIC => C:\Users\Public
SESSIONNAME => Console
SystemDrive => C:
SystemRoot => C:\Windows
TEMP => C:\Users\Xilence\AppData\Local\Temp
TMP => C:\xampp\tmp
USERDOMAIN => Aurora51
USERNAME => Xilence
USERPROFILE => C:\Users\Xilence
windir => C:\Windows

PHP Variables

Variable => Value
_SERVER["ALLUSERSPROFILE"] => C:\ProgramData
_SERVER["AMDAPPSDKROOT"] => C:\Program Files (x86)\AMD APP\
_SERVER["APPDATA"] => C:\Users\Xilence\AppData\Roaming
_SERVER["asl_log"] => Destination=file
_SERVER["CommonProgramFiles"] => C:\Program Files (x86)\Common Files
_SERVER["CommonProgramFiles(x86)"] => C:\Program Files (x86)\Common Files
_SERVER["CommonProgramW6432"] => C:\Program Files\Common Files
_SERVER["COMPUTERNAME"] => AURORA51
_SERVER["ComSpec"] => C:\Windows\system32\cmd.exe
_SERVER["FP_NO_HOST_CHECK"] => NO
_SERVER["GPU_MAX_ALLOC_PERCENT"] => 50
_SERVER["HOMEDRIVE"] => C:
_SERVER["HOMEPATH"] => \Users\Xilence
_SERVER["HuluDesktopPath"] => C:\Users\Xilence\AppData\Local\HuluDesktop\instanc
es\0.9.14.1\HuluDesktop.exe
_SERVER["LOCALAPPDATA"] => C:\Users\Xilence\AppData\Local
_SERVER["LOGONSERVER"] => \\AURORA51
_SERVER["MIBDIRS"] => C:/xampp/php/extras/mibs
_SERVER["MYSQL_HOME"] => C:\xampp\mysql\bin
_SERVER["NUMBER_OF_PROCESSORS"] => 4
_SERVER["OPENSSL_CONF"] => C:/xampp/apache/bin/openssl.cnf
_SERVER["OS"] => Windows_NT
_SERVER["Path"] => ;C:\xampp\;C:\xampp\php;C:\xampp\perl\site\bin;C:\xampp\perl\
bin;C:\xampp\apache\bin;C:\xampp\mysql\bin;C:\xampp\FileZillaFTP;C:\xampp\Mercur
yMail;C:\xampp\sendmail;C:\xampp\webalizer;C:\xampp\tomcat\bin;C:\Program Files
(x86)\iis express\PHP\v5.6;C:\ProgramData\Oracle\Java\javapath;C:\Program Files
(x86)\AMD APP\bin\x86_64;C:\Program Files (x86)\AMD APP\bin\x86;C:\zpanel\bin\ap
ache\bin;C:\zpanel\bin\mysql\bin;C:\zpanel\bin\php;C:\zpanel\bin\wget;C:\zpanel\
bin\bind\bin;C:\Program Files\Common Files\Microsoft Shared\Windows Live;C:\Prog
ram Files (x86)\Common Files\Microsoft Shared\Windows Live;C:\Program Files (x86
)\NVIDIA Corporation\PhysX\Common;C:\Windows\system32;C:\Windows;C:\Windows\Syst
em32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\ATI
 Technologies\ATI.ACE\Core-Static;C:\Program Files\Perforce;C:\Program Files (x8
6)\Windows Live\Shared;C:\Program Files\Perforce\Server;C:\Program Files\Microso
ft\Web Platform Installer\;;C:\Program Files\Perforce\Server
_SERVER["PATHEXT"] => .COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC
_SERVER["PHPRC"] => C:\xampp\php
_SERVER["PHP_PEAR_BIN_DIR"] => C:\xampp\php
_SERVER["PHP_PEAR_CFG_DIR"] => C:\xampp\php\cfg
_SERVER["PHP_PEAR_DATA_DIR"] => C:\xampp\php\data
_SERVER["PHP_PEAR_DOC_DIR"] => C:\xampp\php\docs
_SERVER["PHP_PEAR_INSTALL_DIR"] => C:\xampp\php\pear
_SERVER["PHP_PEAR_PHP_BIN"] => C:\xampp\php\php.exe
_SERVER["PHP_PEAR_SYSCONF_DIR"] => C:\xampp\php
_SERVER["PHP_PEAR_TEST_DIR"] => C:\xampp\php\tests
_SERVER["PHP_PEAR_WWW_DIR"] => C:\xampp\php\www
_SERVER["PROCESSOR_ARCHITECTURE"] => x86
_SERVER["PROCESSOR_ARCHITEW6432"] => AMD64
_SERVER["PROCESSOR_IDENTIFIER"] => AMD64 Family 16 Model 4 Stepping 3, Authentic
AMD
_SERVER["PROCESSOR_LEVEL"] => 16
_SERVER["PROCESSOR_REVISION"] => 0403
_SERVER["ProgramData"] => C:\ProgramData
_SERVER["ProgramFiles"] => C:\Program Files (x86)
_SERVER["ProgramFiles(x86)"] => C:\Program Files (x86)
_SERVER["ProgramW6432"] => C:\Program Files
_SERVER["PROMPT"] => Xilence@AURORA51$S$P$_#$S
_SERVER["PSModulePath"] => C:\Windows\system32\WindowsPowerShell\v1.0\Modules\
_SERVER["PUBLIC"] => C:\Users\Public
_SERVER["SESSIONNAME"] => Console
_SERVER["SystemDrive"] => C:
_SERVER["SystemRoot"] => C:\Windows
_SERVER["TEMP"] => C:\Users\Xilence\AppData\Local\Temp
_SERVER["TMP"] => C:\xampp\tmp
_SERVER["USERDOMAIN"] => Aurora51
_SERVER["USERNAME"] => Xilence
_SERVER["USERPROFILE"] => C:\Users\Xilence
_SERVER["windir"] => C:\Windows
_SERVER["PHP_SELF"] =>
_SERVER["SCRIPT_NAME"] =>
_SERVER["SCRIPT_FILENAME"] =>
_SERVER["PATH_TRANSLATED"] =>
_SERVER["DOCUMENT_ROOT"] =>
_SERVER["REQUEST_TIME_FLOAT"] => 1420338712.5439
_SERVER["REQUEST_TIME"] => 1420338712
_SERVER["argv"] => Array
(
)

_SERVER["argc"] => 0

PHP License
This program is free software; you can redistribute it and/or modify
it under the terms of the PHP License as published by the PHP Group
and included in the distribution in the file:  LICENSE

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

If you did not receive a copy of the PHP license, or have any
questions about PHP licensing, please contact license@php.net.

Xilence@AURORA51 c:\xampp
#

2 个答案:

答案 0 :(得分:0)

我对你的问题感到有点困惑,但我认为你问的是,当你的php页面被调用时,它会返回php脚本而不是执行它(我不明白为什么Ajax在这里很重要 - 我假设如果您直接浏览浏览器中的php页面会发生同样的情况吗?)

我的第一个问题是你是否在服务器上安装了php,因为这是这种情况下的常见问题?如果没有,假设它是Linux然后运行apt-get install php5(如果它是ubuntu,Debian或类似Mint)或yum install php5(如果它是Redhat Fedora或Centos)

如果安装了php,请检查你的httpd.conf(通常在/ etc / httpd / conf中)并检查是否正在加载php模块 - 我不会详细介绍这个,因为Google充满了好处有关Apache配置的信息。

同时检查你的php页面是否可执行,因为它是一个脚本(ls -l yourphppagename.php并在左边查找x个字符)

答案 1 :(得分:0)

好的我修好了。这对我来说真的很愚蠢,但在我编辑的某个地方,我删除了文档开头的<?php部分并且只有<?因此导致它不被服务器解析,无论如何..非常感谢大家的帮助!应该把代码放在首位。我下次会的。再次,谢谢!