IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

Langage PHP Discussion :

scandir impossible et ne renvoie pas d'erreurs


Sujet :

Langage PHP

  1. #1
    Membre averti
    Homme Profil pro
    Développeur Web
    Inscrit en
    Mars 2016
    Messages
    17
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Paris (Île de France)

    Informations professionnelles :
    Activité : Développeur Web

    Informations forums :
    Inscription : Mars 2016
    Messages : 17
    Par défaut scandir impossible et ne renvoie pas d'erreurs
    Bonjour en PHP 7.0 avec apache sous ubuntu je n'arrive pas à scanner un répertoire
    à partir du .php qui est à la racine du projet
    voici le code php
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
     
         <?php foreach(scandir(__DIR__.'/img/photo/realisation') as $filename){
             echo $filename;
         }?>
    Il n'affiche rien

    et j'ai ces droits dans le réperoire img directement sous le .php qui est à la racine du projet :
    drwxrwx--- 4 root www-data 4096 déc. 29 10:26 img
    et dans img
    drwxrwx--- 7 root www-data 4096 déc. 29 10:26 photo
    et dans photo
    drwxrwx--- 2 root www-data 4096 déc. 29 10:26 realisation
    et dans realisation
    -rwxrwx--- 1 root www-data 66312 sept. 23 2014 toto.jpg

    nota :
    Je n'ai pas d'erreurs php dans les logs
    j'ai lancé apache avec l'utilisateur root

    Que faire?

  2. #2
    Modérateur
    Avatar de sabotage
    Homme Profil pro
    Inscrit en
    Juillet 2005
    Messages
    29 208
    Détails du profil
    Informations personnelles :
    Sexe : Homme

    Informations forums :
    Inscription : Juillet 2005
    Messages : 29 208
    Par défaut
    Tu as contrôlé ce que valait __DIR__.'/img/photo/realisation ?
    N'oubliez pas de consulter les FAQ PHP et les cours et tutoriels PHP

  3. #3
    Membre averti
    Homme Profil pro
    Développeur Web
    Inscrit en
    Mars 2016
    Messages
    17
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Paris (Île de France)

    Informations professionnelles :
    Activité : Développeur Web

    Informations forums :
    Inscription : Mars 2016
    Messages : 17
    Par défaut
    oui


    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
     
    <?php echo __DIR__."/img/photo/realisation"; ?>
    affiche bien
    /var/www/html/img/photo/realisation

    et mon php est bien dans /var/www/html/

  4. #4
    Membre averti
    Homme Profil pro
    Développeur Web
    Inscrit en
    Mars 2016
    Messages
    17
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Paris (Île de France)

    Informations professionnelles :
    Activité : Développeur Web

    Informations forums :
    Inscription : Mars 2016
    Messages : 17
    Par défaut
    en fait j'arrive bien à scanner les répertoires mais c'est l'utilisation de timthumb.php qui pose problème, il n'affiche pas les images.
    le html généré est :
    <div class="fotorama__stage__frame fotorama__error fotorama__active" style="left: 0px;"></div>
    et cela me génère plein d'erreurs, sur la console avec f12 j'ai pleins d'erreur 400 style:
    timthumb.php:1 GET http://10.50.0.19/timthumb.php?src=/...203.JPG&w=1000 400 (Bad Request)
    Pourtant je n'ai pas changé timthumb.php je viens juste de tout réinstaller sur un nouveau serveur apache (avec le module rewrite activé)

    Voici mon code entier de /var/www/html/realisation.php:

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
     
    <?php include("inc/header.php"); ?>
     
    <div class="page realisation">
     
    -a-
    <?php echo __DIR__."/img/photo/realisation"; ?>
    -b-<?php
    ini_set('display_errors', '1');
    error_reporting(E_ALL);
     
    var_dump(__DIR__);
    echo '<hr />';
     
    var_dump(scandir(__DIR__));
    echo '<hr />';
     
    var_dump(scandir(__DIR__.'/img'));
    echo '<hr />';
     
    var_dump(scandir(__DIR__.'/img/photo'));
    echo '<hr />';
     
    var_dump(scandir(__DIR__.'/img/photo/realisation'));
    echo '<hr />';
    ?>
    -c-
         <?php foreach(scandir(__DIR__.'/img/photo/realisation') as $filename){
             echo $filename;
         }?>
    -d-
     
                        <?php $photos = scandir(__DIR__.'/img/photo/realisation'); ?>
                        <?php foreach ($photos as $p) { ?>
                            <?php if ($p != '..' & $p != '.'): ?>
                                <?= $p ?>
                            <?php endif ?>
                        <?php } ?>
    -e-
                 <div class="foto-container">
                    <div class="fotorama" data-nav="thumbs" data-nav="thumbs" data-thumbheight="64" data-thumbheight="64"
                        data-autoplay="true"
                        data-width="100%"
                        data-ratio="800/500">
     
                    <?php $photos = scandir(__DIR__.'/img/photo/realisation'); ?>
                        <?php foreach ($photos as $p) { ?>
                            <?php if ($p != '..' & $p != '.'): ?>
                                <img src="/timthumb.php?src=/img/photo/realisation/<?= $p ?>&w=1000">
                            <?php endif ?>
                        <?php } ?>
                    </div>
                </div>
    </div>
     
    <?php include("inc/footer.php"); ?>

    et ce qu'il m'affiche:


    -a- /var/www/html/img/photo/realisation

    -b-string(13) "/var/www/html"
    array(20) { [0]=> string(1) "." [1]=> string(2) ".." [2]=> string(21) "Presentation_Full.mp4" [3]=> string(21) "Presentation_Half.mp4" [4]=> string(5) "cache" [5]=> string(11) "contact.php" [6]=> string(16) "contact_send.php" [7]=> string(3) "css" [8]=> string(5) "fonts" [9]=> string(10) "groupe.php" [10]=> string(3) "img" [11]=> string(3) "inc" [12]=> string(9) "index.php" [13]=> string(2) "js" [14]=> string(15) "realisation.php" [15]=> string(15) "recrut_send.php" [16]=> string(15) "recrutement.php" [17]=> string(11) "service.php" [18]=> string(11) "station.php" [19]=> string(12) "timthumb.php" }
    array(17) { [0]=> string(1) "." [1]=> string(2) ".." [2]=> string(8) "bg01.jpg" [3]=> string(8) "bg01.png" [4]=> string(9) "bgmap.png" [5]=> string(4) "icon" [6]=> string(8) "logo.png" [7]=> string(7) "map.jpg" [8]=> string(5) "photo" [9]=> string(11) "station.png" [10]=> string(15) "wafit_blanc.png" [11]=> string(9) "zone1.png" [12]=> string(9) "zone2.png" [13]=> string(9) "zone3.png" [14]=> string(9) "zone4.png" [15]=> string(9) "zone5.png" [16]=> string(9) "zone6.png" }
    array(7) { [0]=> string(1) "." [1]=> string(2) ".." [2]=> string(7) "accueil" [3]=> string(7) "bandeau" [4]=> string(11) "realisation" [5]=> string(7) "resized" [6]=> string(7) "service" }
    array(43) { [0]=> string(1) "." [1]=> string(2) ".." [2]=> string(16) "AD systeme U.JPG" [3]=> string(8) "AGIP.jpg" [4]=> string(20) "Apareil Dis ESSO.JPG" [5]=> string(10) "BLIGNY.jpg" [6]=> string(15) "Boutique BP.jpg" [7]=> string(11) "Cuves 3.JPG" [8]=> string(9) "Cuves.jpg" [9]=> string(16) "Distribution.jpg" [10]=> string(59) "ESSO DIETSCH Remplacement des tuyauteries de depotages .JPG" [11]=> string(8) "Elan.JPG" [12]=> string(16) "ElectricitВ.jpg" [13]=> string(26) "Genie civil Palplanche.JPG" [14]=> string(17) "Intermarche 1.JPG" [15]=> string(16) "Ludo S50 014.jpg" [16]=> string(12) "Monoprix.jpg" [17]=> string(19) "Port - leperrey.jpg" [18]=> string(14) "Privatif 1.JPG" [19]=> string(11) "St Pois.JPG" [20]=> string(20) "Systeme U - Brie.jpg" [21]=> string(22) "Systeme U Beauvais.JPG" [22]=> string(17) "Toilettes PMR.JPG" [23]=> string(33) "Total Fos-03-04-2008-DSCF1946.JPG" [24]=> string(15) "Tuyaterie 1.JPG" [25]=> string(34) "Tuyauterie - DВpot PВtrolier.JPG" [26]=> string(14) "Tuyauterie.JPG" [27]=> string(16) "acess mureau.JPG" [28]=> string(26) "chateau-20130507-00449.jpg" [29]=> string(11) "chateau.JPG" [30]=> string(26) "chateau20130523_084835.jpg" [31]=> string(26) "chateau20130523_084853.jpg" [32]=> string(26) "chateau20130523_085241.jpg" [33]=> string(26) "chateau20130523_085307.jpg" [34]=> string(11) "cuves 2.JPG" [35]=> string(15) "intermarche.JPG" [36]=> string(14) "privatif 2.JPG" [37]=> string(14) "privatif 3.JPG" [38]=> string(14) "privatif 4.jpg" [39]=> string(14) "privatif 5.jpg" [40]=> string(14) "privatif 6.JPG" [41]=> string(14) "privatif 7.jpg" [42]=> string(24) "systeme U Palplanche.jpg" }

    -c- ...AD systeme U.JPGAGIP.jpgApareil Dis ESSO.JPGBLIGNY.jpgBoutique BP.jpgCuves 3.JPGCuves.jpgDistribution.jpgESSO DIETSCH Remplacement des tuyauteries de depotages .JPGElan.JPGElectricitВ.jpgGenie civil Palplanche.JPGIntermarche 1.JPGLudo S50 014.jpgMonoprix.jpgPort - leperrey.jpgPrivatif 1.JPGSt Pois.JPGSysteme U - Brie.jpgSysteme U Beauvais.JPGToilettes PMR.JPGTotal Fos-03-04-2008-DSCF1946.JPGTuyaterie 1.JPGTuyauterie - DВpot PВtrolier.JPGTuyauterie.JPGacess mureau.JPGchateau-20130507-00449.jpgchateau.JPGchateau20130523_084835.jpgchateau20130523_084853.jpgchateau20130523_085241.jpgchateau20130523_085307.jpgcuves 2.JPGintermarche.JPGprivatif 2.JPGprivatif 3.JPGprivatif 4.jpgprivatif 5.jpgprivatif 6.JPGprivatif 7.jpgsysteme U Palplanche.jpg

    -d- AD systeme U.JPG AGIP.jpg Apareil Dis ESSO.JPG BLIGNY.jpg Boutique BP.jpg Cuves 3.JPG Cuves.jpg Distribution.jpg ESSO DIETSCH Remplacement des tuyauteries de depotages .JPG Elan.JPG ElectricitВ.jpg Genie civil Palplanche.JPG Intermarche 1.JPG Ludo S50 014.jpg Monoprix.jpg Port - leperrey.jpg Privatif 1.JPG St Pois.JPG Systeme U - Brie.jpg Systeme U Beauvais.JPG Toilettes PMR.JPG Total Fos-03-04-2008-DSCF1946.JPG Tuyaterie 1.JPG Tuyauterie - DВpot PВtrolier.JPG Tuyauterie.JPG acess mureau.JPG chateau-20130507-00449.jpg chateau.JPG chateau20130523_084835.jpg chateau20130523_084853.jpg chateau20130523_085241.jpg chateau20130523_085307.jpg cuves 2.JPG intermarche.JPG privatif 2.JPG privatif 3.JPG privatif 4.jpg privatif 5.jpg privatif 6.JPG privatif 7.jpg systeme U Palplanche.jpg

    -e-

  5. #5
    Membre averti
    Homme Profil pro
    Développeur Web
    Inscrit en
    Mars 2016
    Messages
    17
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Paris (Île de France)

    Informations professionnelles :
    Activité : Développeur Web

    Informations forums :
    Inscription : Mars 2016
    Messages : 17
    Par défaut
    j'ai une bonne piste
    http://10.50.0.19/timthumb.php?src=/...ais.JPG&w=1000
    m'affiche :
    A TimThumb error has occured

    The following error(s) occured:
    GD Library Error: imagecreatetruecolor does not exist - please contact your webhost and ask them to install the GD library

    Query String : src=/img/photo/realisation/Systeme%20U%20Beauvais.JPG&w=1000
    TimThumb version : 2.8.13

    savez vous comment installer cette librairie sous debian?

  6. #6
    Rédacteur/Modérateur
    Avatar de andry.aime
    Homme Profil pro
    Inscrit en
    Septembre 2007
    Messages
    8 391
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : Ile Maurice

    Informations forums :
    Inscription : Septembre 2007
    Messages : 8 391
    Par défaut
    Bonjour,

    Php 7:
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    sudo apt-get install php7.0-gd (ou php7.1-gd ou php7.2-gd)
    Php 5:
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    sudo apt-get install php5-gd
    A+.

+ Répondre à la discussion
Cette discussion est résolue.

Discussions similaires

  1. Réponses: 4
    Dernier message: 17/05/2013, 12h18
  2. Pourquoi ça ne me renvoie pas d'erreurs ?
    Par zizoufoot dans le forum C
    Réponses: 7
    Dernier message: 03/05/2013, 22h23
  3. [MySQL] Une requête update qui ne renvoie pas d'erreur mais qui n'update pas
    Par Marc22 dans le forum PHP & Base de données
    Réponses: 17
    Dernier message: 16/06/2010, 17h59
  4. [PHP 5.2] mon serveur ne renvoie pas les erreurs pHp
    Par cipic dans le forum Langage
    Réponses: 4
    Dernier message: 25/04/2009, 20h07
  5. MySQL ne renvoie pas d'erreur alors que la chaine est fausse
    Par repié dans le forum SQL Procédural
    Réponses: 2
    Dernier message: 07/11/2007, 12h18

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo