[Web] Formulaire POST

Applications, problèmes de configuration réseau
Répondre
AchilleFraisse
Elfe
Messages : 618
Inscription : dim. 27 avr. 2014, 09:32

[Web] Formulaire POST

Message par AchilleFraisse »

Bonjour,

Je ne sais pas ce que j'ai fais, mais j'ai 4 sites sur mon réseau local, et sur chacun des sites, lorsque je clique sur envoyer sur un formulaire (post), il m'affiche une page :

Code : Tout sélectionner

The localhost page isn’t working

localhost is currently unable to handle this request.
HTTP ERROR 500
Je ne sais pas pourquoi. Pourtant mon code marche bien.
Quelques chose qui s'est déconfiguré ?
Fanch
archer
Messages : 144
Inscription : lun. 01 déc. 2008, 21:16

Re: [Web] Formulaire POST

Message par Fanch »

500 c'est une erreur coté serveur, il faudrait lire les logs du dit serveur pour en savoir plus...
"The three principal virtues of a programmer are Laziness, Impatience, and Hubris." -> man perl
AchilleFraisse
Elfe
Messages : 618
Inscription : dim. 27 avr. 2014, 09:32

Re: [Web] Formulaire POST

Message par AchilleFraisse »

Et je les trouves où ? Mon serveur est apache2
Avatar de l’utilisateur
benjarobin
Maître du Kyudo
Messages : 17230
Inscription : sam. 30 mai 2009, 15:48
Localisation : Lyon

Re: [Web] Formulaire POST

Message par benjarobin »

Ici: /var/log/httpd
Zsh | KDE | PC fixe : core i7, carte nvidia
Titre d'un sujet : [Thème] Sujet (état) / Règles du forum
AchilleFraisse
Elfe
Messages : 618
Inscription : dim. 27 avr. 2014, 09:32

Re: [Web] Formulaire POST

Message par AchilleFraisse »

Voilà les logs, lorsque je tente d'envoyer mon formulaire :

Code : Tout sélectionner

[Sat Oct 15 18:37:09.331810 2016] [:error] [pid 16357] [client ::1:34874] PHP Notice:  Undefined index: logout in /srv/http/mon_site/include/header.php on line 100
[Sat Oct 15 18:37:09.332105 2016] [:error] [pid 16357] [client ::1:34874] PHP Notice:  A session had already been started - ignoring session_start() in /srv/http/mon_site/include/header.php on line 114
[Sat Oct 15 18:37:09.356145 2016] [:error] [pid 16357] [client ::1:34874] PHP Fatal error:  Uncaught Error: Call to undefined function mysql_connect() in /srv/http/mon_site/fonction/connectes.php:4\nStack trace:\n#0 /srv/http/mon_site/include/footer.php(8): connectes()\n#1 /srv/http/mon_site/news/index.php(175): include('/srv/http/mon_site/i...')\n#2 {main}\n  thrown in /srv/http/mon_site/fonction/connectes.php on line 4
[Sat Oct 15 18:37:09.430304 2016] [:error] [pid 16357] [client ::1:34874] PHP Fatal error:  Uncaught Error: Call to undefined function mysql_connect() in /srv/http/mon_site/fonction/connectes.php:4\nStack trace:\n#0 /srv/http/mon_site/include/footer.php(8): connectes()\n#1 /srv/http/mon_site/admin/error.php(35): include('/srv/http/mon_site/i...')\n#2 {main}\n  thrown in /srv/http/mon_site/fonction/connectes.php on line 4, referer: http://localhost/mon_site/news/index.php
[Sat Oct 15 18:37:09.434323 2016] [:error] [pid 9562] [client ::1:34876] PHP Fatal error:  Uncaught Error: Call to undefined function mysql_connect() in /srv/http/mon_site/fonction/connectes.php:4\nStack trace:\n#0 /srv/http/mon_site/include/footer.php(8): connectes()\n#1 /srv/http/mon_site/admin/error.php(35): include('/srv/http/mon_site/i...')\n#2 {main}\n  thrown in /srv/http/mon_site/fonction/connectes.php on line 4, referer: http://localhost/mon_site/news/index.php
[Sat Oct 15 18:37:09.443760 2016] [:error] [pid 9562] [client ::1:34876] PHP Fatal error:  Uncaught Error: Call to undefined function mysql_connect() in /srv/http/mon_site/fonction/connectes.php:4\nStack trace:\n#0 /srv/http/mon_site/include/footer.php(8): connectes()\n#1 /srv/http/mon_site/admin/error.php(35): include('/srv/http/mon_site/i...')\n#2 {main}\n  thrown in /srv/http/mon_site/fonction/connectes.php on line 4, referer: http://localhost/mon_site/news/index.php
[Sat Oct 15 18:37:09.447607 2016] [:error] [pid 9174] [client ::1:34878] PHP Fatal error:  Uncaught Error: Call to undefined function mysql_connect() in /srv/http/mon_site/fonction/connectes.php:4\nStack trace:\n#0 /srv/http/mon_site/include/footer.php(8): connectes()\n#1 /srv/http/mon_site/admin/error.php(35): include('/srv/http/mon_site/i...')\n#2 {main}\n  thrown in /srv/http/mon_site/fonction/connectes.php on line 4, referer: http://localhost/mon_site/news/index.php
[Sat Oct 15 18:37:09.451120 2016] [:error] [pid 10299] [client ::1:34880] PHP Fatal error:  Uncaught Error: Call to undefined function mysql_connect() in /srv/http/mon_site/fonction/connectes.php:4\nStack trace:\n#0 /srv/http/mon_site/include/footer.php(8): connectes()\n#1 /srv/http/mon_site/admin/error.php(35): include('/srv/http/mon_site/i...')\n#2 {main}\n  thrown in /srv/http/mon_site/fonction/connectes.php on line 4, referer: http://localhost/mon_site/news/index.php
[Sat Oct 15 18:37:09.454676 2016] [:error] [pid 24541] [client ::1:34882] PHP Fatal error:  Uncaught Error: Call to undefined function mysql_connect() in /srv/http/mon_site/fonction/connectes.php:4\nStack trace:\n#0 /srv/http/mon_site/include/footer.php(8): connectes()\n#1 /srv/http/mon_site/admin/error.php(35): include('/srv/http/mon_site/i...')\n#2 {main}\n  thrown in /srv/http/mon_site/fonction/connectes.php on line 4, referer: http://localhost/mon_site/news/index.php
[Sat Oct 15 18:37:09.458396 2016] [:error] [pid 12066] [client ::1:34884] PHP Fatal error:  Uncaught Error: Call to undefined function mysql_connect() in /srv/http/mon_site/fonction/connectes.php:4\nStack trace:\n#0 /srv/http/mon_site/include/footer.php(8): connectes()\n#1 /srv/http/mon_site/admin/error.php(35): include('/srv/http/mon_site/i...')\n#2 {main}\n  thrown in /srv/http/mon_site/fonction/connectes.php on line 4, referer: http://localhost/mon_site/news/index.php
[Sat Oct 15 18:37:09.462315 2016] [:error] [pid 9562] [client ::1:34876] PHP Fatal error:  Uncaught Error: Call to undefined function mysql_connect() in /srv/http/mon_site/fonction/connectes.php:4\nStack trace:\n#0 /srv/http/mon_site/include/footer.php(8): connectes()\n#1 /srv/http/mon_site/admin/error.php(35): include('/srv/http/mon_site/i...')\n#2 {main}\n  thrown in /srv/http/mon_site/fonction/connectes.php on line 4, referer: http://localhost/mon_site/news/index.php
[Sat Oct 15 18:37:09.466229 2016] [:error] [pid 16357] [client ::1:34874] PHP Fatal error:  Uncaught Error: Call to undefined function mysql_connect() in /srv/http/mon_site/fonction/connectes.php:4\nStack trace:\n#0 /srv/http/mon_site/include/footer.php(8): connectes()\n#1 /srv/http/mon_site/admin/error.php(35): include('/srv/http/mon_site/i...')\n#2 {main}\n  thrown in /srv/http/mon_site/fonction/connectes.php on line 4, referer: http://localhost/mon_site/news/index.php
[Sat Oct 15 18:37:09.684786 2016] [:error] [pid 9562] [client ::1:34876] PHP Fatal error:  Uncaught Error: Call to undefined function mysql_connect() in /srv/http/mon_site/fonction/connectes.php:4\nStack trace:\n#0 /srv/http/mon_site/include/footer.php(8): connectes()\n#1 /srv/http/mon_site/admin/error.php(35): include('/srv/http/mon_site/i...')\n#2 {main}\n  thrown in /srv/http/mon_site/fonction/connectes.php on line 4, referer: http://localhost/mon_site/news/index.php
[Sat Oct 15 18:37:09.690773 2016] [:error] [pid 12066] [client ::1:34884] PHP Fatal error:  Uncaught Error: Call to undefined function mysql_connect() in /srv/http/mon_site/fonction/connectes.php:4\nStack trace:\n#0 /srv/http/mon_site/include/footer.php(8): connectes()\n#1 /srv/http/mon_site/admin/error.php(35): include('/srv/http/mon_site/i...')\n#2 {main}\n  thrown in /srv/http/mon_site/fonction/connectes.php on line 4, referer: http://localhost/mon_site/news/index.php
[Sat Oct 15 18:37:09.696528 2016] [:error] [pid 9562] [client ::1:34876] PHP Fatal error:  Uncaught Error: Call to undefined function mysql_connect() in /srv/http/mon_site/fonction/connectes.php:4\nStack trace:\n#0 /srv/http/mon_site/include/footer.php(8): connectes()\n#1 /srv/http/mon_site/admin/error.php(35): include('/srv/http/mon_site/i...')\n#2 {main}\n  thrown in /srv/http/mon_site/fonction/connectes.php on line 4, referer: http://localhost/mon_site/news/index.php
[Sat Oct 15 18:37:09.702125 2016] [:error] [pid 24541] [client ::1:34882] PHP Fatal error:  Uncaught Error: Call to undefined function mysql_connect() in /srv/http/mon_site/fonction/connectes.php:4\nStack trace:\n#0 /srv/http/mon_site/include/footer.php(8): connectes()\n#1 /srv/http/mon_site/admin/error.php(35): include('/srv/http/mon_site/i...')\n#2 {main}\n  thrown in /srv/http/mon_site/fonction/connectes.php on line 4, referer: http://localhost/mon_site/news/index.php
[Sat Oct 15 18:37:09.707419 2016] [:error] [pid 10299] [client ::1:34880] PHP Fatal error:  Uncaught Error: Call to undefined function mysql_connect() in /srv/http/mon_site/fonction/connectes.php:4\nStack trace:\n#0 /srv/http/mon_site/include/footer.php(8): connectes()\n#1 /srv/http/mon_site/admin/error.php(35): include('/srv/http/mon_site/i...')\n#2 {main}\n  thrown in /srv/http/mon_site/fonction/connectes.php on line 4, referer: http://localhost/mon_site/news/index.php
[Sat Oct 15 18:37:09.713796 2016] [:error] [pid 9174] [client ::1:34878] PHP Fatal error:  Uncaught Error: Call to undefined function mysql_connect() in /srv/http/mon_site/fonction/connectes.php:4\nStack trace:\n#0 /srv/http/mon_site/include/footer.php(8): connectes()\n#1 /srv/http/mon_site/admin/error.php(35): include('/srv/http/mon_site/i...')\n#2 {main}\n  thrown in /srv/http/mon_site/fonction/connectes.php on line 4, referer: http://localhost/mon_site/news/index.php
[Sat Oct 15 18:37:09.719285 2016] [:error] [pid 12066] [client ::1:34884] PHP Fatal error:  Uncaught Error: Call to undefined function mysql_connect() in /srv/http/mon_site/fonction/connectes.php:4\nStack trace:\n#0 /srv/http/mon_site/include/footer.php(8): connectes()\n#1 /srv/http/mon_site/admin/error.php(35): include('/srv/http/mon_site/i...')\n#2 {main}\n  thrown in /srv/http/mon_site/fonction/connectes.php on line 4, referer: http://localhost/mon_site/news/index.php
[Sat Oct 15 18:37:09.723691 2016] [:error] [pid 16357] [client ::1:34874] PHP Fatal error:  Uncaught Error: Call to undefined function mysql_connect() in /srv/http/mon_site/fonction/connectes.php:4\nStack trace:\n#0 /srv/http/mon_site/include/footer.php(8): connectes()\n#1 /srv/http/mon_site/admin/error.php(35): include('/srv/http/mon_site/i...')\n#2 {main}\n  thrown in /srv/http/mon_site/fonction/connectes.php on line 4, referer: http://localhost/mon_site/news/index.php
[Sat Oct 15 18:37:09.729022 2016] [:error] [pid 9562] [client ::1:34876] PHP Fatal error:  Uncaught Error: Call to undefined function mysql_connect() in /srv/http/mon_site/fonction/connectes.php:4\nStack trace:\n#0 /srv/http/mon_site/include/footer.php(8): connectes()\n#1 /srv/http/mon_site/admin/error.php(35): include('/srv/http/mon_site/i...')\n#2 {main}\n  thrown in /srv/http/mon_site/fonction/connectes.php on line 4, referer: http://localhost/mon_site/news/index.php
[Sat Oct 15 18:37:10.596217 2016] [:error] [pid 9562] [client ::1:34876] PHP Fatal error:  Uncaught Error: Call to undefined function mysql_connect() in /srv/http/mon_site/fonction/connectes.php:4\nStack trace:\n#0 /srv/http/mon_site/include/footer.php(8): connectes()\n#1 /srv/http/mon_site/news/form.php(88): include('/srv/http/mon_site/i...')\n#2 {main}\n  thrown in /srv/http/mon_site/fonction/connectes.php on line 4, referer: http://localhost/mon_site/news/index.php
[Sat Oct 15 18:37:14.646320 2016] [:error] [pid 9174] [client ::1:34878] PHP Fatal error:  Uncaught Error: Call to a member function fetch() on boolean in /srv/http/mon_site/news/proc.php:44\nStack trace:\n#0 {main}\n  thrown in /srv/http/mon_site/news/proc.php on line 44, referer: http://localhost/mon_site/news/form.php
Si je comprend bien, il a l'air de ne pas connaître la fonction mysql_connect().
Bizzare, puisqu'il y a 3 jours, ca marchait nickel...
Avatar de l’utilisateur
benjarobin
Maître du Kyudo
Messages : 17230
Inscription : sam. 30 mai 2009, 15:48
Localisation : Lyon

Re: [Web] Formulaire POST

Message par benjarobin »

Je ne vois pas comment il y a 3 jours cela pouvait fonctionner... Cette fonction n'existe plus en PHP 7, à moins de ne pas avoir fait de mise à jour régulière...
Zsh | KDE | PC fixe : core i7, carte nvidia
Titre d'un sujet : [Thème] Sujet (état) / Règles du forum
AchilleFraisse
Elfe
Messages : 618
Inscription : dim. 27 avr. 2014, 09:32

Re: [Web] Formulaire POST

Message par AchilleFraisse »

Je viens de la changer avec :

Code : Tout sélectionner

$bdd = new PDO('mysql:host=localhost;dbname=bdd;charset=utf8', 'root', 'password');
Mais ce ne marche toujours pas.
Les logs :

Code : Tout sélectionner

[Sat Oct 15 19:07:16.058823 2016] [:error] [pid 18772] [client ::1:35380] PHP Fatal error:  Uncaught Error: Call to a member function fetch() on boolean in /srv/http/mon_site/news/proc.php:44\nStack trace:\n#0 {main}\n  thrown in /srv/http/mon_site/news/proc.php on line 44, referer: http://localhost/mon_site/news/form.php
Avatar de l’utilisateur
benjarobin
Maître du Kyudo
Messages : 17230
Inscription : sam. 30 mai 2009, 15:48
Localisation : Lyon

Re: [Web] Formulaire POST

Message par benjarobin »

Cela n'a rien à voir avec Arch Linux... La fonction fetch n'existe pas en php...
Je ne sais pas ce que tu attends ici comme aide, surtout que tu ne donnes pas de code source, et que tu donnes toi même la raison du problème... Après pour le corriger tu es le seul à le pouvoir, donc comment veux tu que l'on t'aide. De toute façon ce n'est pas vraiment le bon forum pour ce genre de question/problème
Zsh | KDE | PC fixe : core i7, carte nvidia
Titre d'un sujet : [Thème] Sujet (état) / Règles du forum
AchilleFraisse
Elfe
Messages : 618
Inscription : dim. 27 avr. 2014, 09:32

Re: [Web] Formulaire POST

Message par AchilleFraisse »

Quand tu fait un :

Code : Tout sélectionner

$bdd = new PDO ...
$req = $bdd->query('...');
$data = $req->fetch()
fetch n'existe pas : http://php.net/manual/fr/pdostatement.fetch.php ?

Je pose la question ici, parce que mon site ne marche PLUS sur mon réseau locale, mais marche sur les serveur d'ovh (c'est exactement le même).
Du coup je pense que c'est un problème de Arch de config. Surement quelque chose qui a sauté lors d'une maj. Mais comme il y a des maj toutes les heures sous Arch, ben je ne sais pas ce que c'est.

Voilà du pourquoi je pose ma question ICI .
Avatar de l’utilisateur
benjarobin
Maître du Kyudo
Messages : 17230
Inscription : sam. 30 mai 2009, 15:48
Localisation : Lyon

Re: [Web] Formulaire POST

Message par benjarobin »

Comme déjà indiqué, Arch Linux utilise php 7, qui est une énorme évolution de php 5 (encore utilisé chez OVH) ! Donc aucun problème de configuration ici, tu utilisais juste du code marqué comme déprécié depuis très longtemps !

Et pour le fetch, l'erreur t'indique que tu essayes d'appeler la fonction fetch sur un boolean. Sans voir le code complet c'est impossible d'aider, ton code est juste invalide !!!
Pour information
PDO::query() retourne un objet PDOStatement, ou FALSE si une erreur survient.
Donc je pense que la fonction query retourne FALSE. ce n'est pas bien de ne pas faire de gestion d'erreur...
Sinon migrer de l'ancienne API de mysql vers l'API PDO n'est pas ce qu'il y a de plus simple, pourquoi ne pas avoir utilisé l'API mysqli ?
Zsh | KDE | PC fixe : core i7, carte nvidia
Titre d'un sujet : [Thème] Sujet (état) / Règles du forum
Répondre