要求任何PHP文件与函数生成500内部服务器错误


require any php file with function generate 500 internal server error

我有一个问题require_once './DBFunctions.php';而服务器产生这个错误,一旦我需要任何文件与函数,甚至在调用该函数之前,顺便说一句,我的代码在本地正常工作(即,这个错误只有当我在服务器上测试脚本时)。

我的问题是有任何错误与函数关键字在php版本5.2.5(我使用mysql库而不是mysqli,因为它不支持我的服务器)。

这是我的代码

index . php

<?php  require_once "./DBfun.php" ?>
<!-- html goes here -->

DBfun.php

 <?php require_once './DBConfig.php';
 function sanitize(&$data) {
return htmlentities(strip_tags(mysql_real_escape_string($data)));}
function isExist($username) {
    $username = sanitize($username);
   $query = "SELECT * FROM `USERS` WHERE `USERNAME` ='$username' AND `STATUS`=1";
$result = mysql_query($query);
$row_cnt = mysql_num_rows($result);
$r = ($row_cnt == 1) ? "1 row matched (User Exist)" : " No matched found (User does 't      exist)";
$log = "Query: " . $query . PHP_EOL . "Result: " . $r . PHP_EOL;
//file_put_contents(LOG_FILE, $log, FILE_APPEND | LOCK_EX);
// destruct($result);
return ($row_cnt == 1) ? TRUE : FALSE;}
 ?>

我测试了所有DB连接,查询(检索数据& &;显示它),ajax请求,要求文件甚至嵌套要求等。没有函数,&它为我工作,当我使用(取消注释)任何函数=(

时出现错误

我得到的错误:

 GET http://192.168.0.36/ProjectName/index.php 500 (Internal Server Error) 

您可以在要求..之前检查文件是否存在。但是我确信这不是问题所在。

<?php
    $file = './path/to/file.php';
    if (is_file($file))
    {
        require_once($file);
    }
?>

感谢大家的帮助问题出在服务器的php版本上我在脚本

中使用的预定义函数array_map