Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
PHP werkt niet goed...[OPGELOST]
View unanswered posts
View posts from last 24 hours

Goto page 1, 2  Next  
Reply to topic    Gentoo Forums Forum Index Dutch
View previous topic :: View next topic  
Author Message
Azerix
Guru
Guru


Joined: 19 Dec 2004
Posts: 346
Location: NL

PostPosted: Sat May 14, 2005 10:57 am    Post subject: PHP werkt niet goed...[OPGELOST] Reply with quote

hi,

Ik krijg steeds foutmelding als ik de volgende code gebruik om in het midden paginas te includen.
<?php
{
include($_GET['page']);
}
?>
De paginas worden wel geinclude, maar als index.php word geladen dan krijg in eerste stantie foutmelding in het midden. Als ik op de knoppen click dan worden de paginas wel geinclude.

Quote:

Fatal error: main(): Failed opening required '' (include_path='.:/usr/lib/php') in index.php on line 287


Ik dacht dat het aan mijn server lag, dus ik heb Apache en php opnieuw geinstalleerd. Maar ik krijg dat foutmelding nog steeds. Ik weet niet of het aan de code ligt of aan mijn webserver.

Heeft iemand einige idee waar zou het aan liggen?


Last edited by Azerix on Sun Jun 19, 2005 7:45 pm; edited 1 time in total
Back to top
View user's profile Send private message
fuge
Tux's lil' helper
Tux's lil' helper


Joined: 08 May 2004
Posts: 117
Location: Brugge, Belgium (Europe)

PostPosted: Sat May 14, 2005 2:09 pm    Post subject: Reply with quote

Mss omdat $_GET['page'] leeg is bij gewoon index.php en als je op een pagina klikt niet. Hoogst waarschijnlijk geen systeem (gentoo) probleem.
Back to top
View user's profile Send private message
Azerix
Guru
Guru


Joined: 19 Dec 2004
Posts: 346
Location: NL

PostPosted: Sat May 14, 2005 8:26 pm    Post subject: Reply with quote

hhmm, nou jah ik heb verschillende code gebruikt en toch zelfde fout.
Back to top
View user's profile Send private message
fuge
Tux's lil' helper
Tux's lil' helper


Joined: 08 May 2004
Posts: 117
Location: Brugge, Belgium (Europe)

PostPosted: Sat May 14, 2005 9:34 pm    Post subject: Reply with quote

Steek eerst je getpage in een variable als hij niet gelijk is aan null en indien wel zet je gewoon index of whatever ge wilt includen op je eerste pagina. En werk dan met die variabele die nooit leeg zal zijn ;)
Back to top
View user's profile Send private message
Azerix
Guru
Guru


Joined: 19 Dec 2004
Posts: 346
Location: NL

PostPosted: Sat May 14, 2005 11:30 pm    Post subject: Reply with quote

Ik heb register_globasl aan gezet. Ik heb dat probleem niet meer? Maar ik weet niet welke gevolgen heeft als je de register_globals aanzet.
Back to top
View user's profile Send private message
Rainmaker
Veteran
Veteran


Joined: 12 Feb 2004
Posts: 1650
Location: /home/NL/ehv/

PostPosted: Sun May 15, 2005 12:53 am    Post subject: Reply with quote

is $_GET niet vervangen in versie 4 door HTTP_GET_VARS?

btw, lijkt eerder op een probleem met je IncludePath variabele, daar staat alleen /var/lib/php in... Voeg een . toe (huidige directory)
_________________
If you can't dazzle them with brilliance, baffle them with bullshit.
Back to top
View user's profile Send private message
Azerix
Guru
Guru


Joined: 19 Dec 2004
Posts: 346
Location: NL

PostPosted: Sun May 15, 2005 11:15 am    Post subject: Reply with quote

Dat is mij ook opgevallen, ik snap niet waarom wijzt ie naar /var/lib/php :? Rainmaker, Ik heb gewoon een directory php aangemaakt, dat bedoeld je toch met toevoegen van nieuwe directory?
Back to top
View user's profile Send private message
nixnut
Bodhisattva
Bodhisattva


Joined: 09 Apr 2004
Posts: 10974
Location: the dutch mountains

PostPosted: Sun May 15, 2005 4:38 pm    Post subject: Reply with quote

Code:
include($_GET['page']);
Dat verteld php dat ie een file moet inlezen. Als de variabele $_GET['page'] niet tot een geldige padnaam herleid kan worden, gaat php klagen dat ie die file niet in zijn include_path kan vinden.
_________________
Please add [solved] to the initial post's subject line if you feel your problem is resolved. Help answer the unanswered

talk is cheap. supply exceeds demand
Back to top
View user's profile Send private message
Rainmaker
Veteran
Veteran


Joined: 12 Feb 2004
Posts: 1650
Location: /home/NL/ehv/

PostPosted: Sun May 15, 2005 10:39 pm    Post subject: Reply with quote

Azerix wrote:
Dat is mij ook opgevallen, ik snap niet waarom wijzt ie naar /var/lib/php :? Rainmaker, Ik heb gewoon een directory php aangemaakt, dat bedoeld je toch met toevoegen van nieuwe directory?


Nee, ik bedoelde, controleer of je

iinclude_path = ".:/usr/lib/php"

in je /etc/apache2/conf/php.ini hebt staan (let op die .)

Die punt zorgt namelijk dat naast die /var directory ook de huidige directory wordt doorzocht bij include() aanroepen.
_________________
If you can't dazzle them with brilliance, baffle them with bullshit.
Back to top
View user's profile Send private message
Azerix
Guru
Guru


Joined: 19 Dec 2004
Posts: 346
Location: NL

PostPosted: Mon May 16, 2005 2:46 pm    Post subject: Reply with quote

In /usr/lib/ had ik de map php niet, dus dat had ik aangemaakt. En /etc/apache2/conf/php.ini heb ik ook staan
Back to top
View user's profile Send private message
Rainmaker
Veteran
Veteran


Joined: 12 Feb 2004
Posts: 1650
Location: /home/NL/ehv/

PostPosted: Tue May 17, 2005 1:40 am    Post subject: Reply with quote

kun je eens de output posten van

Code:
cat /etc/apache2/conf/php.ini | grep include_path | grep -v \;
?
_________________
If you can't dazzle them with brilliance, baffle them with bullshit.
Back to top
View user's profile Send private message
nielchiano
Veteran
Veteran


Joined: 11 Nov 2003
Posts: 1287
Location: 50N 3E

PostPosted: Mon May 30, 2005 4:12 pm    Post subject: Re: PHP werkt niet goed... Reply with quote

Azerix wrote:

include($_GET['page']);

niet direct gerelateerd aan je vraag, maar ik kan het mij niet laten om het toch te melden:
DOE DIT NOOIT
Op die manier laat je de gebruiker toe een willekeurig bestand te bekijken, inclusief bestanden die je liever niet wil:
als ik "http://blabla/index.php?page=/etc/passwd" zou opvragen krijg ik gewoon je users te zien!
DOE ALTIJD een check op user-data.

Ok, dit gepreekt zijnde: het probleem is inderdaad dat bij de eerste aanvraag van de pagina $_GET['page'] = ""
ER komt dus te staan: include("") wat uiteraard een error geeft omdat hij geen bestand vind zonder naam.
Back to top
View user's profile Send private message
GaDDiM
n00b
n00b


Joined: 01 Jan 2005
Posts: 38

PostPosted: Mon May 30, 2005 5:29 pm    Post subject: Reply with quote

Rainmaker wrote:
is $_GET niet vervangen in versie 4 door HTTP_GET_VARS?

btw, lijkt eerder op een probleem met je IncludePath variabele, daar staat alleen /var/lib/php in... Voeg een . toe (huidige directory)


Nee, niet echt. In PHP 4 is $_GET en co geintroduceerd als super global en omdat het korter is. En in PHP 5 kun je de VARS arrays zelf uitzetten.
De includePath klopt wel want de huidige directory staat er al in (zie error). De $_GET['page'] is gewoon gelijk aan '' en dat bestand bestaat niet. Mss is dit wel een oplossing ook vanwege het bovenstaande veiligheidsprobleem

Code:

<?php
$allow_pages = array (
   'page1.php',
   'page2.php'
);

if ($_GET['page']) {
   if (in_array ($_GET['page'], $allow_pages)) {
      include ($_GET['page']);
   } else { // SECURITY BREACH
      /* bedenk zelf maar wat, mss kun je jezelf een email sturen met ip of een pagina tonen dat er iets fout is */
   }
} else {
   /* de index pagina */
}
?>


De register_globals maken het systeem ook niet echt veiliger, kun je beter uitzetten als je de arrays $_GET, $_POST, $_SERVER, $_SESSION gebruikt
Back to top
View user's profile Send private message
Azerix
Guru
Guru


Joined: 19 Dec 2004
Posts: 346
Location: NL

PostPosted: Tue May 31, 2005 8:18 pm    Post subject: Reply with quote

Ik heb een andere oplossing gevonden..... Gewoon andere code gebruikt, werkt prima.
Back to top
View user's profile Send private message
Azerix
Guru
Guru


Joined: 19 Dec 2004
Posts: 346
Location: NL

PostPosted: Sun Jun 12, 2005 4:35 pm    Post subject: Reply with quote

Ik heb nog steeds de zelfde probleem met include_path. Ik heb verschillende php variabelen gebruikt en het werkt niet en ik krijg de zelfde foutlmelding. Dit is de output van php.ini
Quote:

incluth_path=".:/usr/lib/php"


Ik weet nu wel zeker dat het aan de server ligt.
Back to top
View user's profile Send private message
nixnut
Bodhisattva
Bodhisattva


Joined: 09 Apr 2004
Posts: 10974
Location: the dutch mountains

PostPosted: Sun Jun 12, 2005 6:53 pm    Post subject: Reply with quote

Code:
incluth_path=".:/usr/lib/php"
probeer include_path eens, in plaats van incluth_path :wink:
_________________
Please add [solved] to the initial post's subject line if you feel your problem is resolved. Help answer the unanswered

talk is cheap. supply exceeds demand
Back to top
View user's profile Send private message
Azerix
Guru
Guru


Joined: 19 Dec 2004
Posts: 346
Location: NL

PostPosted: Sun Jun 12, 2005 7:35 pm    Post subject: Reply with quote

nixnut wrote:
Code:
incluth_path=".:/usr/lib/php"
probeer include_path eens, in plaats van incluth_path :wink:


Nee, dat is een type fout. :? Dit is de foutmelding

Quote:

(include_path='.:/usr/lib/php')
Back to top
View user's profile Send private message
nixnut
Bodhisattva
Bodhisattva


Joined: 09 Apr 2004
Posts: 10974
Location: the dutch mountains

PostPosted: Sun Jun 12, 2005 7:52 pm    Post subject: Reply with quote

Wat is de volledige foutmelding? Php probeert een bestand in te lezen en zoekt dat in het path dat in include_path is gespecificeerd. Als dat bestand daar niet te vinden is krijg je een foutmelding. De vraag is dan welk bestand dat is en waar dat dan wel staat.
_________________
Please add [solved] to the initial post's subject line if you feel your problem is resolved. Help answer the unanswered

talk is cheap. supply exceeds demand
Back to top
View user's profile Send private message
Azerix
Guru
Guru


Joined: 19 Dec 2004
Posts: 346
Location: NL

PostPosted: Mon Jun 13, 2005 7:17 am    Post subject: Reply with quote

Ik heb paar fouten gevonden in mijn php bestand, maar opzicht ook als het aan mijn php bestand liegt. Dan waarom zoekt ie in directory /usr/lib/php? als of hij probeert te includen via /usr/lib/php :? dat is zo en zo verkeerd. Ik zal het vanavond posten de hele php variabel.
Back to top
View user's profile Send private message
ikke
Apprentice
Apprentice


Joined: 14 Jan 2005
Posts: 225
Location: Belgium

PostPosted: Mon Jun 13, 2005 10:05 am    Post subject: Reply with quote

Azerix wrote:
Ik heb paar fouten gevonden in mijn php bestand, maar opzicht ook als het aan mijn php bestand liegt. Dan waarom zoekt ie in directory /usr/lib/php? als of hij probeert te includen via /usr/lib/php :? dat is zo en zo verkeerd. Ik zal het vanavond posten de hele php variabel.
PEAR zit in /usr/lib/php...
_________________
Working day and night to enhance your Linux Desktop experience :)
Blog
Back to top
View user's profile Send private message
Azerix
Guru
Guru


Joined: 19 Dec 2004
Posts: 346
Location: NL

PostPosted: Tue Jun 14, 2005 11:57 am    Post subject: Reply with quote

Nee , hoef niet meer. Ik weet wat de probleem is, mijn PC functioneert niet goed quoa hardware. Ik heb al vaker problemen mee gehaad. Soms bij het opstarten van PC starten de volgende applicaties niet op

apache,
mysqld,
postifx

Soms als ik een applicatie installeer dan werkt het eerste keer niet , maar de volgende keer wel. Ik denk dat het moederbord is niet helemaal goed. Dit foutmeldinf krijg ik te ziene als ik inlog in mysql
Quote:

De $cfg['PmaAbsoluteUri'] richtlijn MOET gezet zijn in het configuratie bestand!
Back to top
View user's profile Send private message
ikke
Apprentice
Apprentice


Joined: 14 Jan 2005
Posts: 225
Location: Belgium

PostPosted: Wed Jun 15, 2005 8:48 am    Post subject: Reply with quote

Azerix wrote:
Nee , hoef niet meer. Ik weet wat de probleem is, mijn PC functioneert niet goed quoa hardware. Ik heb al vaker problemen mee gehaad. Soms bij het opstarten van PC starten de volgende applicaties niet op

apache,
mysqld,
postifx

Soms als ik een applicatie installeer dan werkt het eerste keer niet , maar de volgende keer wel. Ik denk dat het moederbord is niet helemaal goed. Dit foutmeldinf krijg ik te ziene als ik inlog in mysql
Quote:

De $cfg['PmaAbsoluteUri'] richtlijn MOET gezet zijn in het configuratie bestand!
Das niet inloggen in mysql, is inloggen in phpmyadmin. En dat zegt gewoon dat u webapp niet goed geconfigureerd is.
_________________
Working day and night to enhance your Linux Desktop experience :)
Blog
Back to top
View user's profile Send private message
Azerix
Guru
Guru


Joined: 19 Dec 2004
Posts: 346
Location: NL

PostPosted: Wed Jun 15, 2005 10:35 am    Post subject: Reply with quote

Nee dat is wel inloggen in mysql via phpmyadmin. Je hebt wel gelijk dat het kan zijn dat ik niet goed geconfigureert heb. Welke webapplicatie bedoel je dan precies?
Back to top
View user's profile Send private message
Rainmaker
Veteran
Veteran


Joined: 12 Feb 2004
Posts: 1650
Location: /home/NL/ehv/

PostPosted: Wed Jun 15, 2005 11:21 pm    Post subject: Reply with quote

hij bedoeld phpmyadmin

Phpadmin waarschuwt je dat je een dingetje bent vergeten te configureren, namelijk die $cfg['PmaAbsoluteUri'] variabele.

Heeft niks te maken met een fout / slechte config van php of apache, puur die van phpmyadmin.

Kijk eens in de config: /var/www/localhost/htdocs/phpmyadmin/config.inc.php
_________________
If you can't dazzle them with brilliance, baffle them with bullshit.
Back to top
View user's profile Send private message
ikke
Apprentice
Apprentice


Joined: 14 Jan 2005
Posts: 225
Location: Belgium

PostPosted: Thu Jun 16, 2005 11:39 am    Post subject: Reply with quote

Azerix wrote:
Nee dat is wel inloggen in mysql via phpmyadmin.
In MySQL kan je niet inloggen, je kan enkel een connectie starten met de server. Het inloggen zelf doe je in de applicatie, in dit geval PMA
_________________
Working day and night to enhance your Linux Desktop experience :)
Blog
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Dutch All times are GMT
Goto page 1, 2  Next
Page 1 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum