Problemi su include_path

ho un problema.

ho 2 cartelle

la prima è include posizionata in /miosito/include/

la seconda è public_html in /miosito/public_html/

il file index.html è in public_html.

In index.html ho inserito il codice

<?php include ("/programmi/easyphp/www/miosito/include/prepend.inc");?>

<?php

Ecco cosa ottengo:

Fatal error: Failed opening required '/programmi/easyphp/www/miosito/include/prepend.inc' (include_path='.;C:\Programmi\EasyPHP\php\pear\') in C:\Programmi\EasyPHP\www\miosito\public_html\index.html on line 2

cosa ho sbagliato?

inviato 11 anni fa
franco
X 0 X

Ciao franco e benvenuto,

quando ti riferisci ad un file devi usare o un percorso assoluto, del tipo 'C:\mia cartella\mio file.php', oppure un persorso relativo, in cui spieghi la strada per arrivare al file che ti serve partendo dalla cartella in cui si trova il file chiamante.

Nel primo caso dovresti quindi usare la seguente istruzione:

<?php include ("C:\Programmi\EasyPHP\www\miosito\include\prepend.inc");?>

Nel secondo caso invece:

<?php include ("..\include\prepend.inc");?>

dove i due punti iniziali ".." significano "vai nella cartella superiore alla corrente" (C:\Programmi\EasyPHP\www\miosito\) e poi entra in "include\prepend.inc"

 :bye:

risposto 11 anni fa
Gianni Tomasicchio
X 0 X

Mille grazie per l'aiuto.

Riesco a visualizzare il sito.

Però se clicco su una qualsiasi categoria ottengo

Warning: Failed opening 'header.inc' for inclusion (include_path='.;C:\Programmi\EasyPHP\php\pear\') in c:\programmi\easyphp\www\prisma\public_html\cat.html on line 1

Warning: Accès refusé pour l'utilisateur: 'ODBC@localhost' (mot de passe: NON) in c:\programmi\easyphp\www\prisma\public_html\cat.html on line 8

Warning: MySQL Connection Failed: Accès refusé pour l'utilisateur: 'ODBC@localhost' (mot de passe: NON) in c:\programmi\easyphp\www\prisma\public_html\cat.html on line 8

Warning: MySQL: A link to the server could not be established in c:\programmi\easyphp\www\prisma\public_html\cat.html on line 8

Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in c:\programmi\easyphp\www\prisma\public_html\cat.html on line 9

Fatal error: Call to undefined function: display_percorso() in c:\programmi\easyphp\www\prisma\public_html\cat.html on line 13

il file sorgente di cat.html è

?php include("header.inc");?>

<?php

$cat=$_GET[cat];

global $limit, $newoffset, $offset;

$limit=3;

if (empty($offset))

  $offset=0;

$result = mysql_query ("select * from notizie where categoria ='$cat'");

$numrows = mysql_num_rows($result);

?>

                  <div style="margin-left:20px;margin-right:15px">

                  <?php

                        echo display_percorso($cat);

                  ?>

                      <br><br>

                   <?php display_sotto_categorie($cat);?>

                     <p>

                     <?php

                     if($offset==0 || $offset==''){

                              ?>

                     <table cellpadding="0" cellspacing="0" border="0" width="100%">

                     <tr>

                     <td valign="top" style="text-align:justify;">

                     <label class="text2">

                     <?php

                        echo get_table_campo("categorie","descrizione","id",$cat);

                     ?>

                     </label>

                     </td>

                     <?php

                        if(get_table_campo("categorie","immagine","id",$cat))

                           echo "<td width=\"20%\" valign=\"top\"><image src='show_image.php?cat=$cat' style=\"margin-left:10px\"></td>";

                     ?>

                     </tr>

                     <tr><td height="20px"></td></tr>

                              <tr><td colspan="2" style="background-color:gray"></td></tr>

                     </table>

                     </p>

                     <p>

                     <?php }?>

                        <?php

                        display_news_all($cat,$offset,$limit);

                     ?>

                     </p>

                              <?php

                                    $pages=intval($numrows/$limit);

                                    if($numrows == 0) {

                                    $pages = 1;

                                    }

                                    if ($numrows%$limit) {

                                        $pages++;

                                    }

                                    if ($offset != 0) {

                                        $prevoffset=$offset-$limit;

                                        echo "<a class=\"a1\" href=\"cat.html?cat=$cat&offset=$prevoffset\">&laquo; Precedente</a> &nbsp; \n";

                                    }

                                    if ( $pages != 1 ) {

                                        for ($i=1;$i<=$pages;$i++) {

                                            $newoffset=$limit*($i-1);

                                            if ( ((($offset)/$limit)==($i-1)) ) {

                                            echo "<font class=\"gal\"><b>$i</b></font> &nbsp; \n";

                                            } else {

                                                echo "<a class=\"a1\" href=\"cat.html?cat=$cat&offset=$newoffset\">$i</a> &nbsp; \n";

                                            }

                                        }

                                    }

                                    if (!((($offset)/$limit)+1==$pages) && $pages!=1) {

                                        $newoffset=$offset+$limit;

                                        echo "<a class=\"a1\" href=\"cat.html?cat=$cat&offset=$newoffset\">Avanti &raquo;</a><p>\n";

                                    }

                              ?>

                  </div>

<?php include("footer.inc");?>

il file cat.html si trova in public_html mentre header.inc nella cartella include

 :bye:

risposto 11 anni fa
franco
X 0 X

Si tratta sempre di problemi di percorso.

Correggi le righe

<?php include("header.inc");?>

e

<?php include("footer.inc");?>
risposto 11 anni fa
Gianni Tomasicchio
modificato 11 anni fa
X 0 X

Ancora grazie.

ho il seguente messaggio:

      Fatal error: Call to undefined function: get_table_campo() in c:\programmi\easyphp\www\prisma\include\header.inc on line 32

il codice di header.inc è:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3c.org/TR/1999/REC-html401-19991224/loose.dtd">

<html>

<head>

<TITLE>PRISMA INFORMATICA - WEB SITE</TITLE>

<meta name="resource-type" content="document">

<meta http-equiv="pragma" content="no-cache">

<meta name="revisit-after" content="4">

<meta name="classification" content="Commercial">

<meta name="description" content="">

<meta name="keywords" content="">

<meta name="robots" content="ALL">

<meta name="distribution" content="Global">

<meta name="rating" content="Safe For Kids">

<meta name="copyright" content="">

<meta name="author" content="">

<meta http-equiv="reply-to" content="">

<meta name="language" content="italian">

<meta name="doc-type" content="Web Page">

<meta name="doc-class" content="Living Document">

<meta name="doc-rights" content="Public Domain">

<link rel="shortcut icon" href="http://www.prismainfo.it/icons/prisma.ico" >

<script language="javascript" src="scripts/scripts.js"></script>

<link href="styles/style.css" rel="stylesheet" type="text/css" >

</head>

<BODY onload="<?php if(strstr($PHP_SELF,"cat.html")) echo "initdoc();";?>" BGCOLOR=#FFFFFF LEFTMARGIN=0 TOPMARGIN=0 rightmargin="0" bottommargin="0" MARGINWIDTH=0 MARGINHEIGHT=0>

<center>

<TABLE WIDTH=100% BORDER=0 CELLPADDING=0 CELLSPACING=0 height="100%">

   <TR>

   <TD width="50%" rowspan="3" height="100%" background="images/bg1.jpg" style="background-position:top right "></TD>

      <TD>

      <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="768" height="108">

          <param name="movie" value="flash/<?php echo get_table_campo("header_flash","nome","attivato","1");?>">

          <param name="quality" value="high">

          <embed src="flash/<?php echo get_table_campo("header_flash","nome","attivato","1");?>" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="768" height="108"></embed>

    </object>

       </TD>

            <TD width="50%" rowspan="3" height="100%" background="images/bg2.jpg" style="background-position:top left "></TD>

   </TR>

   <TR>

      <TD><TABLE WIDTH=768 BORDER=0 CELLPADDING=0 CELLSPACING=0>

          <TR>

            <TD height="100%" style="background:url(images/11_new.jpg) no-repeat right bottom"> <TABLE WIDTH=125 BORDER=0 CELLPADDING=0 CELLSPACING=0 height="100%">

              <TR>

                <TD COLSPAN=2>

               <table cellpadding="0" cellspacing="0" width="125">

              <TR>

                 <TD style="background:url(images/25.jpg) top top" WIDTH=25></TD>

                <TD align="right" WIDTH=95>

            <TABLE WIDTH=95 BORDER=0 CELLPADDING=0 CELLSPACING=0>

                      <TR>

                        <TD> <IMG SRC="images/m0.jpg" WIDTH=95 HEIGHT=42 ALT=""></TD>

                      </TR>

                  <?php display_categorie();?>

                      <TR>

                        <TD> <IMG SRC="images/m05.jpg" WIDTH=95 HEIGHT=33 ALT=""></TD>

                      </TR>

                    </TABLE>

                </TD>

                 <TD style="background:url(images/26.jpg) top top" WIDTH=5 ALT=""></TD>

              </TR>

               </table>

                </TD>

              </TR>

              <TR>

               <TD background="images/bak3.jpg" WIDTH=24 HEIGHT=100% ALT=""></TD>

                <TD height="100%"> <TABLE WIDTH=101 BORDER=0 CELLPADDING=0 CELLSPACING=0 height="100%">

                  <TR>

                    <TD> <IMG SRC="images/3.jpg" WIDTH=101 HEIGHT=74 ALT=""></TD>

                  </TR>

                  <TR>

                    <TD> <IMG SRC="images/5.jpg" WIDTH=101 HEIGHT=70 ALT=""></TD>

                  </TR>

                  <?php

                              $sql="select id,link,nome from banner where selected='on' order by RAND() limit 0,5";

                              $res=mysql_query($sql) or die("Errore show_banner.php: $sql");;

                              while($row=mysql_fetch_array($res))

                              {

                  ?>

                  <?php if($row[id]){?>

                  <TR>

                    <TD style="background:url(images/border_left.jpg) no-repeat right top;"> <a target="_new" href="<?php echo $row[link];?>"><IMG SRC="show_banner.php?id=<?php echo $row[id];?>" ALT="<?php echo $row[nome];?>" WIDTH=96  border="0"></a></TD>

                  </TR>

                  <TR>

                    <TD style="background:url(images/border_left.jpg) no-repeat right top;"><IMG SRC="images/line_space.jpg" ALT="" WIDTH=101  border="0"></a></TD>

                  </TR>

                  <?php }

                }

                  ?>

                  <TR>

                    <TD style="background:url(images/11.jpg) no-repeat top top" WIDTH="101" height="100%"></TD>

                  </TR>

                </TABLE></TD>

              </TR>

            </TABLE></TD>

            <TD background="images/bak1.jpg" WIDTH=12 HEIGHT=100% ALT=""><IMG src="images/2.jpg"></TD>

            <TD height="100%" > <TABLE WIDTH=599 BORDER=0 CELLPADDING=0 CELLSPACING=0  height="100%">

                <TR>

                  <TD> <TABLE WIDTH=599 BORDER=0 CELLPADDING=0 CELLSPACING=0 bgcolor="#d8d8d8">

                      <TR>

                        <TD height="100%"> <TABLE WIDTH=305 BORDER=0 CELLPADDING=0 CELLSPACING=0 height="21%">

                            <TR>

                              <TD width="305"> <IMG SRC="images/19.jpg" WIDTH=305 HEIGHT=20 ALT=""></TD>

                            </TR>

                          </TABLE></TD>

                        <TD height="100%"><IMG SRC="images/16_b.jpg" WIDTH=294 HEIGHT=5 ALT=""></TD>

                      </TR>

                    </TABLE></TD>

                </TR>

                <TR>

                  <TD WIDTH=599 HEIGHT=1000 ALT="" bgcolor="#d8d8d8" align="left" valign="top">

 :bye:

risposto 11 anni fa
franco
X 0 X

Ti prego di attenerti al regolamento (regola n°8)

:chiuso:

P.S.: posso darti una mano nella programmazione PHP ma non posso corregere script scaricati da internet.

risposto 11 anni fa
Gianni Tomasicchio
X 0 X
Effettua l'accesso o registrati per rispondere a questa domanda