עבור לתוכן

בעית Include בPHP

Featured Replies

פורסם

היה לי אתר על השרת הפנימי (במחשב - xampp) ועשיתי פונקציית Inclue מתוך index.php, והכל היה טוב.

<?php include('start.txt'); ?>

<?php include('end.txt'); ?>

כשהעליתי הכל לאינטרנט (דרך bluehost.com - בכסף וכמובן עם דומיין), העמוד הראשי כותב לי:


Warning: include(start.txt) [function.include]: failed to open stream: No such file or directory in /home1/***/public_html/index.php on line 1

Warning: include() [function.include]: Failed opening 'start.txt' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home1/***/public_html/index.php on line 1

איפה שכתוב [function.include] יש קישור, כשאני נכנס לקישור זה מה שכתוב:


Not Found

The requested URL /function.include was not found on this server.

Additionally, a 403 Forbidden error was encountered while trying to use an ErrorDocument to handle the request.
Apache/2.2.9 (Unix) mod_ssl/2.2.9 OpenSSL/0.9.8g DAV/2 mod_auth_passthrough/2.1 mod_bwlimited/1.4 FrontPage/5.0.2.2635 Server at *** Port 80

הנה הפרטים על הגרסאות בשרת:

Apache version	2.2.9 (Unix)
PHP version 5.2.6
MySQL version 5.0.45-community-
log

מה עליי לעשות כדי שהאתר שלי יעבוד על השרת?

פורסם

אני מקווה שהעלת את קובץ הטקסט על השרת באותה תיקייה של אותו דף php

פורסם
  • מחבר

ברור.

הוא נמצא איפה שindex.php וכל השאר, המטרה היא לחסוך מקום על השרת מהדברים שקיימים בכל דף (תפריטים וDIV וכו')

עזרה מישהו?

פורסם

יכול להיות שהם פשוט חסמו את הפונקציה הזאת..

נסה שרת אחר.

פורסם
  • מחבר

אני לא יכול לנסות שרת אחר כי שילמתי כבר על זה.

יכול להיות שצריך לאפשר את הפונקציה באיזושהי דרך?

אגב, זה פותח לי תמונות וכל מיני דברים, זאת אומרת, זה לא שלא רואים כלום, הוא טוען חלק מהתמונות.

למשל באינדקס, הוא טוען לי את התמונה האחרונה שנמצאת בend.txt:

<div style="position: static; height: 19px; width: 800px; background-image: url(../images/index_14.gif);"></div>

מה שאומר שאת end.txt הוא טוען, אבל את start.txt לא (השנייה הבנתי את זה).

הנה start.txt:

<html>
<head>
<title>***</title>
<link rel="shortcut icon" href="../favicon.ico" >
<link rel="stylesheet" type="text/css" href="../***style.css" />
<meta http-equiv="Content-Type" content="text/html; charset=windows-1255">
</head>
<div align="center">
<body bgcolor="black" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<!-- ImageReady Slices (***.psd) -->
<table id="Table_01" width="800" border="0" cellpadding="0" cellspacing="0" align="center">
<tr>
<td colspan="8">
<a href="/index.php" class="highlightit_heading">
<img src="../images/***-1_01.gif" width="800" height="116" border="0" alt=""></a></td>
</tr>
<tr>
<td colspan="8">
<img src="../images/index_02.gif" width="800" height="5" alt=""></td>
</tr>
<tr>
<td>
<img src="../images/index_03.gif" width="17" height="45" alt=""></td>
<td>
<a href="../products.php">
<img src="../images/***-1_04.gif" width="151" height="45" border="0" alt=""></a></td>
<td>
<a href="../support.php">
<img src="../images/***-1_05.gif" width="122" height="45" border="0" alt=""></a></td>
<td>
<a href="../homemade.php">
<img src="../images/***-1_06.gif" width="167" height="45" border="0" alt=""></a></td>
<td>
<a href="../news/">
<img src="../images/***-1_07.gif" width="83" height="45" border="0" alt=""></a></td>
<td>
<a href="../tutorials.php">
<img src="../images/***-1_08.gif" width="125" height="45" border="0" alt=""></a></td>
<td>
<a href="../about.php">
<img src="../images/***-1_09.gif" width="118" height="45" border="0" alt=""></a></td>
<td>
<img src="../images/index_10.gif" width="17" height="45" alt=""></td>
</tr>
<tr>
<td colspan="8">
<img src="../images/index_11.gif" width="800" height="24" alt=""></td>
</tr>


</table>
<!-- End ImageReady Slices -->

<div style="position: static; left: 290px; top: 310px; right: 290px; height: auto; width: 800px; background-image: url(../images/index_12.gif);
background-repeat: repeat;">

השם של האתר צונזר בכוכביות..

מה הבעיה פה?

פורסם

תשאל את המנהלים של השרת.

במצב תקין, כל מה שפועל לך על המחשב כאשר אתה מריץ תוכנת שרת (ו XAMPP עושה את זה מצויין), אמור לרוץ גם על שרת ייעודי.

פורסם
  • מחבר

אגב, לא צייניתי שזה פותח חלק מstart.txt שזה זה:

<link rel="shortcut icon" href="../favicon.ico" >

כלומר, אני מסוגל לראות את האייקון למעלה, זאת אומרת שהבעיה בדף? (אני לא מפסיק לחפש סלאשים שלא במקום...)

עריכה:

עוד "אגב"..

כתוב שהבעיה נמצאת בשורה 1 בindex.php שהכוונה למשפט הinclude. יכול להיות שהכוונה לשורה מספר אחד בstart .txt? (שהיא <html>)

יכול להיות שצריך להגדיר את הHTML??? מה זה לעזאזל?

בינתיים אני מחפש עמוד יצירת קשר עם מנהלי השרת.

פורסם

למה אתה עושה זאת כקובץ .txt

נסה לשנות את הסיומת לסיומת סתם שונה כגון .dat

או סתם דוגמא שנה את הסיומת ל php

פורסם
  • מחבר

טוב הנה מה שהמנהל שלח לי:

Dear Customer,

Remember Linux is all case sensitive. Your file on the server is Start.txt in your script you are trying to inlcude start.txt. You would want to fix the file or the include.

Thanks
Brandon O.

כן, אשכרה קוראים לו "ברנדון" :smile1:

זו כנראה בעיה בקובץ start.txt:


<html>
<head>
<title>***</title>
<link rel="shortcut icon" href="../favicon.ico" >
<link rel="stylesheet" type="text/css" href="../***style.css" />
<meta http-equiv="Content-Type" content="text/html; charset=windows-1255">
</head>
<div align="center">
<body bgcolor="black" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<!-- ImageReady Slices (***.psd) -->
<table id="Table_01" width="800" border="0" cellpadding="0" cellspacing="0" align="center">
<tr>
<td colspan="8">
<a href="/index.php" class="highlightit_heading">
<img src="../images/***-1_01.gif" width="800" height="116" border="0" alt=""></a></td>
</tr>
<tr>
<td colspan="8">
<img src="../images/index_02.gif" width="800" height="5" alt=""></td>
</tr>
<tr>
<td>
<img src="../images/index_03.gif" width="17" height="45" alt=""></td>
<td>
<a href="../products.php">
<img src="../images/***-1_04.gif" width="151" height="45" border="0" alt=""></a></td>
<td>
<a href="../support.php">
<img src="../images/***-1_05.gif" width="122" height="45" border="0" alt=""></a></td>
<td>
<a href="../homemade.php">
<img src="../images/***-1_06.gif" width="167" height="45" border="0" alt=""></a></td>
<td>
<a href="../news/">
<img src="../images/***-1_07.gif" width="83" height="45" border="0" alt=""></a></td>
<td>
<a href="../tutorials.php">
<img src="../images/***-1_08.gif" width="125" height="45" border="0" alt=""></a></td>
<td>
<a href="../about.php">
<img src="../images/***-1_09.gif" width="118" height="45" border="0" alt=""></a></td>
<td>
<img src="../images/index_10.gif" width="17" height="45" alt=""></td>
</tr>
<tr>
<td colspan="8">
<img src="../images/index_11.gif" width="800" height="24" alt=""></td>
</tr>


</table>
<!-- End ImageReady Slices -->

<div style="position: static; left: 290px; top: 310px; right: 290px; height: auto; width: 800px; background-image: url(../images/index_12.gif);
background-repeat: repeat;">

זה end.txt למרות שבו אין בעיות:




</div>
<div style="position: static; height: 19px; width: 800px; background-image: url(../images/index_14.gif);"></div>

</body>
</div>
</html>

index.php הוא החיבור של שניהם למי שלא הבין.

מישהו רואה את הבעיה?

פורסם

יש אפשרות לחסום את INCLUDE בקובץ INI, תנסה להשתמש ב-REQUIRE_ONCE

פורסם

הוא אומר לך בדיוק מה הבעיה... שרתי לינוקס הם case sensitive.

אתה עושה אינקלוד לstart.txt, והקובץ שנמצא אצלך הוא Start.txt. מבחינתו אלה שני קבצים שונים, אז הוא לא מוצא אותו.

מומלץ שכל הקבצים שלך יהיו באותיות קטנות בשביל למנוע בלבול.

פורסם
  • מחבר

אני אוהב אותך.

:xyxthumbs:

(לא אני לא מגזים זו בעיה שהייתה לי המון המון זמן)

עריכה:

ותודה לכל העוזרים.

פורסם

אני ממליץ לך ללמוד אנגלית, זה מאוד חשוב בתחום הזה.

פורסם

מחזק,

באמת, הוא הביא לך את התשובה הברורה ביותר על מגש של זהב ואתה אפילו מדביק אותה פה בפורום ולא טורח לקרוא אותה :kopfpatsch:

פורסם
  • מחבר

אני יודע יודע אנגלית מצויין. דילגתי על המילה case, והבנתי כך שיש לי בעיית syntax בקובץ start.txt.

זה קורה לי הרבה משום מה ואין קשר לרמת האנגלית שלי.

ארכיון

דיון זה הועבר לארכיון ולא ניתן להוסיף בו תגובות חדשות.

דיונים חדשים