PHP error Failed to open stream: No such file or directory

Viewed 34

enter image description here I have this error in php that does not let me show the products of a table but I have no idea why if I already tried everything with the address and it does not show me and the same error keeps appearing

This is my code

<center><h1>Datos del producto</h1></center>
<center>
    <table border="1"> </center>
        <tr>
            <th>ID</th>
            <th>Nombre</th>
            <th>Tipo</th>
            <th>Precio</th>
            <th>Cantidad</th>
            <th>ID Vendedor</th>
            <th>Imagen</th>
            <th>Descripcion</th>
            <?php include ("/Modelo/S_Mostrar.php") ?>
        </tr>
    </table>

enter image description here

1 Answers

Your include_path is missing . for the current directory. You should adjust your php.ini config to include . for the current directory. Alternatively, use absolute paths such as through __DIR__ rather than relative paths and you should be able to find your files.

Note also a leading forward slash won't start at the web root. It would start at your system's root, which would be D: in your case.

You should add __DIR__ in front like so:

<?php include __DIR__ . '/Modelo/S_Mostrar.php' ?>
Related