是什么导致这个PHP页面在WAMPServer中正常工作,而不是在web服务器上工作?

是什么导致这个PHP页面在WAMPServer中正常工作,而不是在web服务器上工作?,php,html,web-services,Php,Html,Web Services,我用PHP制作了一个HTML页面来测试多语言体系结构并学习PHP 文件中的函数接收语言变量段落号,筛选文本文件并返回适当的字符串 我一直在本地测试它,并确保它正常工作,但当我在我的托管服务上尝试此操作时(确保所有路径和所有内容都保持不变),脚本不会加载,然后会出现服务器错误消息 我还确保局域网上的PHP版本与服务器上的版本匹配。(PHP版本5.5.1.2) 是什么导致程序无法运行 PHP文件如下所示: <!DOCTYPE html> <html> <head

我用PHP制作了一个HTML页面来测试多语言体系结构并学习PHP

文件中的函数接收语言变量段落号,筛选文本文件并返回适当的字符串

我一直在本地测试它,并确保它正常工作,但当我在我的托管服务上尝试此操作时(确保所有路径和所有内容都保持不变),脚本不会加载,然后会出现服务器错误消息

我还确保局域网上的PHP版本与服务器上的版本匹配。(PHP版本5.5.1.2)

是什么导致程序无法运行

PHP文件如下所示:

<!DOCTYPE html>
<html>
    <head>
        <title>PHP Test</title>
        <link style rel=stylesheet href="style.css" type="text/css">
    </head>
<?php

function skipLines($numberOfLanguages, $numberOfPairs, $openFile) {
    //for the number of pairs given, skip numOfLangs * 2
    //2 = one line for the numbers and one for the paragraph itself
    for ($x=0; $x < (($numberOfPairs - 1) * $numberOfLanguages * 2); $x = $x + 1) {
        //just casts them into the wind... like ashes
        fgets($openFile);
    }
}

function newRetriever($textPairNumber, $selectedLanguage, $openFile) {

    //3 = numberOfLanguages
    skipLines(3, $textPairNumber, $openFile);

    $languageFound = false;
    //test for language and return when true
    while ($languageFound == false) {

        //get the number and language in text after skipping is done
        $currentPlaceArray = explode(" ", fgets($openFile));
        $currentLanguage = $currentPlaceArray[1];

        if (strcmp($currentLanguage, $selectedLanguage) == 2) {
            $languageFound = true;
            echo utf8_decode(fgets($openFile));
        } else {
            fgets($openFile);
        }

    }

    //rewind
    rewind($openFile);
}
?>
<body>
<h1>Human Rights Declaration</h1>
<p>This page uses PHP to retrieve different copies of text from each language and places them appropriately.</p>
<p>
    <?php
        $f = fopen("rawtext4languages.txt", "r");
        newRetriever("3", "s", $f);
        fclose($f);
    ?>
</p>
</body>
</html>
此外,您可以在此处看到它在服务器上的响应方式:

此外,我从我的托管服务中得到的回答是:

感谢您联系我们的服务台。在最初的 调查您的问题我们注意到您的脚本正在执行 30秒后超时。我们将超时时间增加到120秒, 但这没有帮助。以下是脚本的strace输出:

(感叹词:在堆栈中,我从上面的代码中删除了一个额外的函数,但它基本上只是基于语言变量构建了一个头。0.000060是strace输出中出现奇怪情况的点)

eamonboh@eamonbohan.com[~/public_html/exerces/PHP]#strace-s 2048-r-p
`pgrep-u eamonboh php`
已连接进程29025-中断以退出
0.000000重新启动\u syscall()=0
4.021723书写(1),“\n人权宣言\n此页面使用PHP从每种语言检索文本的不同副本,并将其适当放置。

\n\n”,182)=182 0.000244 getcwd(“/home/eamonboh/public_html/Exercises/PHP”,4096)=41 0.000199 lstat(“/home/eamonboh/public_html/exerces/PHP/rawtexttrilingual.txt”,{st_mode=S_IFREG | 0644,st_size=3262,…})=0 0.000359打开(“/home/eamonboh/public_html/Exercises/PHP/rawtexttrilingual.txt”,O_RDONLY)=3 0.000125 fstat(3,{st_mode=S_IFREG | 0644,st_size=3262,…})=0 0.000163 lseek(3,0,寻道时间)=0 0.000060写入(1,“,4)=4 0.000054写入(1,“1”,3)=3 0.000038写入(1,“,1)=1 0.000134写入(1,“Spanis”,6)=6 0.000038写(1,“h条款”,14)=14
0.000060读取(3,"所有人生而自由,在尊严和权利上一律平等。他们被赋予理性和良知,并应本着兄弟情谊的精神相互对待没有其他人。1.自由和尊严的自由和尊严。2.任何人都有权享有本宣言中规定的所有权利和自由,而不受歧视任何类型的信息,如种族、肤色、性别、语言、宗教、政治或其他观点、民族或社会出身、财产、出生或其他身份。您在上面发布的代码中第56行是什么?您的链接仅显示
你好“;?>
Hi@johncode,我不确定它会是什么,因为它对我来说有55行长。@彼得伯斯,让我更正一下。文件扩展名是PHP而不是伪HTML,谢谢你让我知道!“网站缓存出了问题!”你破坏了主机
1 e
Line in English
1 s
Line in Spanish
1 f
Line in French
1 g
Line in German
2 e
Line in English
(...) And so forth
eamonboh@eamonbohan.com [~/public_html/Exercises/PHP]# strace -s 2048 -r -p
`pgrep -u eamonboh php` 
Process 29025 attached - interrupt to quit
0.000000 restart_syscall(<... resuming interrupted call ...>) = 0
4.021723 write(1, " <body>\n <h1>Human Rights Declaration</h1>\n <p>This page uses PHP to retrieve different copies of text from each language and places them appropriately.</p>\n <p>\n ", 182) = 182
0.000244 getcwd("/home/eamonboh/public_html/Exercises/PHP", 4096) = 41
0.000199 lstat("/home/eamonboh/public_html/Exercises/PHP/rawtexttrilingual.txt", {st_mode=S_IFREG|0644, st_size=3262, ...}) = 0
0.000359 open("/home/eamonboh/public_html/Exercises/PHP/rawtexttrilingual.txt", O_RDONLY) = 3
0.000125 fstat(3, {st_mode=S_IFREG|0644, st_size=3262, ...}) = 0
0.000163 lseek(3, 0, SEEK_CUR) = 0
0.000060 write(1, "<h2>", 4) = 4
0.000054 write(1, "1st", 3) = 3
0.000038 write(1, " ", 1) = 1
0.000134 write(1, "Spanis", 6) = 6
0.000038 write(1, "h article</h2>", 14) = 14
0.000060 read(3, "1 e\nAll human beings are born free and equal in dignity and rights. They are endowed with reason and conscience and should act towards one another in a spirit of brotherhood.\n1 s\nTodos los seres humanos nacen libres e iguales en dignidad y derechos y, dotados como est\303\241n de raz\303\263n y conciencia, deben comportarse fraternalmente los unos con los otros.\n1 f\nTous les \303\252tres humains naissent libres et \303\251gaux en dignit\303\251 et en droits. Ils sont dou\303\251s de raison et de conscience et doivent agir les uns envers les autres dans un esprit de fraternit\303\251.\n2 e\nEveryone is entitled to all the rights and freedoms set forth in this Declaration, without distinction of any kind, such as race, colour, sex, language, religion, political or other opinion, national or social origin, property, birth or other status.</p<p>Furthermore, no distinction shall be made on the basis of the political, jurisdictional or international status of the country or territory to which a person belongs, whether it be independent, trust, non-self-governing or under any other limitation of sovereignty.\n2 s\nToda persona tiene los derechos y libertades proclamados en esta Declaraci\303\263n, sin distinci\303\263n alguna de raza, color, sexo, idioma, religi\303\263n, opini\303\263n pol\303\255tica o de cualquier otra \303\255ndole, origen nacional o social, posici\303\263n econ\303\263mica, nacimiento o cualquier otra condici\303\263n.</p><p>Adem\303\241s, no se har\303\241 distinci\303\263n alguna fundada en la condici\303\263n pol\303\255tica, jur\303\255dica o internacional del pa\303\255s o territorio de cuya jurisdicci\303\263n dependa una persona, tanto si se trata de un pa\303\255s independiente, como de un territorio bajo administraci\303\263n fiduciaria, no aut\303\263nomo o sometido a cualquier otra limitaci\303\263n de soberan\303\255a.\n2 f\nChacun peut se pr\303\251valoir de tous les droits et de toutes les libert\303\251s proclam\303\251s dans la pr\303\251sente D\303\251claration, sans distinction aucune, notamment de race, de couleur, de sexe, de langue, de religion, d'opinion politique ou de toute autre opinion, d'origine nationale ou sociale, de fortune, de naissance ou de toute autre situation.</p><p>D"..., 8192) = 3262
0.000269 read(3, "", 8192) = 0
120.032177 --- SIGPROF (Profiling timer expired) @ 0 (0) ---
0.000170 setitimer(ITIMER_PROF, {it_interval={0, 0}, it_value={120, 0}}, NULL) = 0
0.000134 rt_sigaction(SIGPROF, {0x810d70, [PROF], SA_RESTORER|SA_RESTART, 0x7f3369d02030}, {0x810d70, [PROF], SA_RESTORER|SA_RESTART, 0x7f3369d02030}, 8) = 0
0.000149 rt_sigprocmask(SIG_UNBLOCK, [PROF], NULL, 8) = 0
0.000078 open("php_errorlog", O_WRONLY|O_CREAT|O_APPEND, 0644) = 4
0.000224 write(4, "[12-Mar-2015 15:28:34 America/Chicago] PHP Fatal error: Maximum execution time of 120 seconds exceeded in /home/eamonboh/public_html/Exercises/PHP/phplesson1.php on line 56\n", 174) = 174
0.000102 close(4) = 0
0.000076 write(1, "<br />\n<b>Fatal error</b>: Maximum execution time of 120 seconds exceeded in <b>/home/eamonboh/public_html/Exercises/PHP/phplesson1.php</b> on line <b>56</b><br />\n", 165) = 165
0.000072 chdir("/home/eamonboh/public_html/Exercises/PHP") = 0
0.000048 setitimer(ITIMER_PROF, {it_interval={0, 0}, it_value={0, 0}}, NULL) = 0
0.000088 close(3) = 0
0.000277 --- SIGTERM (Terminated) @ 0 (0) ---