Nieuws:

Welkom, Gast. Alsjeblieft inloggen of registreren.
Heb je de activerings-mail niet ontvangen?

Auteur Topic: php script in firefox  (gelezen 1116 keer)

lucky61

  • Gast
php script in firefox
« Gepost op: 2008/07/11, 05:59:04 »
Ik werk met bluefish om websites te maken. Ik schrijf html pagina's die ik dan in mijn browser (Mozilla Firefox 3) kan bekijken. Ofwel dubbelklikken op het .html bestand, ofwel openen in de bluefish werkomgeving: mijn html pagina wordt in de browser getoond. Werkt prima.

Ik ben van plan php te leren, en heb deze taal op mijn Ubuntu 8.4 geïnstalleerd met Synaptic. Nu overkomt me iets vreemds: als ik een .php bestand dubbelklik (in eigenschappen is aangegeven dat dan Firefox moet worden gebruikt) of als ik dit bestand binnen de werkomgeving van bluefish wil bekijken (wat op hetzelfde neerkomt): wel, dan opent Firefox het ene venster na het andere, het houdt niet op. Ik kan ze niet vlug genoeg sluiten, ik moet een Ctr-Alt-Backspace uitvoeren om niet te crashen.

Allicht iets héél stoms gedaan, vermoed ik... maar ik zou niet weten wat.

Iemand enig idee?

Dank

Jean_

  • Gast
php script in firefox
« Reactie #1 Gepost op: 2008/07/11, 09:17:11 »
Vreemd.

Wat ik er wel van kan vertellen is dat firefox niks met je .php bestanden kan als die niet op een http server staan. Een php bestand uitvoeren kan alleen een webserver zoals apache in samenwerking met de php module ervan.

Offline Ron

  • Forumteam
    • r0n
    • Over Tholen
php script in firefox
« Reactie #2 Gepost op: 2008/07/11, 09:23:48 »
Dat werkt dan ook anders.
PHP is een server site scripting taal, d.w.z. dat je een webserver moet hebben.
Het simpelste kan je gewoon een LAMP server installeren op je PC, dan geef je in Mozilla als website localhost en dan werkt PHP wel.
Mocht je niet weten hoe je een LAMP server installeert, dan moet je even op http://www.ubuntu-nl.org/documentatie/netwerken/lamp/ kijken.

Succes en laat het weten !
Openstandaard Evangelist, OpenSource Promotor, OpenData voorstander.
Xubuntu gebruiker en voorstander
Er is ook nog een andere hobby.

lucky61

  • Gast
php script in firefox
« Reactie #3 Gepost op: 2008/07/11, 14:47:13 »
Het werkt inderdaad op de Apache2 server.

Dank voor de raad.

Ik voer http://localhost in, gevolgd door de naam van het php bestand, zoals http://localhost/test.php. Voorwaarde is wel dat dit php bestand in /var/www zit.

Moet ik al mijn php files naar die map verplaatsen (eventueel sub dirs aanmaken) of is er een andere syntax mogelijk? Ik heb geprobeerd: http://localhost/home/luc/[pad naar mijn bestanden] maar Mozilla zegt dat het bestand niet gevonden kan worden.

Luc

Offline idefix

  • Lid
php script in firefox
« Reactie #4 Gepost op: 2008/07/11, 15:11:43 »
Citaat van: lucky61
Het werkt inderdaad op de Apache2 server.

Dank voor de raad.

Ik voer http://localhost in, gevolgd door de naam van het php bestand, zoals http://localhost/test.php. Voorwaarde is wel dat dit php bestand in /var/www zit.

Moet ik al mijn php files naar die map verplaatsen (eventueel sub dirs aanmaken) of is er een andere syntax mogelijk? Ik heb geprobeerd: http://localhost/home/luc/[pad naar mijn bestanden] maar Mozilla zegt dat het bestand niet gevonden kan worden.

Luc
Als je met subdirs werkt in /var/www, kun je de boel overzichtelijk houden.
Anders kijk je even naar dit:

Adding a virtual host to your LAMP server

This allows us to access a different folder as our webroot from a different address in our browser - face it, 'localhost' or 127.0.0.1 is boring.

Start by adding a new host. This is easy to do via System --> Administration --> Network; click on the Hosts tab, select the localhost item from the list and click properties. You may need to click the 'Unlock' button and enter your password first. Underneath the entry 'localhost', on a new line, add your entry of choice; for example, we'll use 'testhost'. Add this, and close all the dialogs.

To confirm that the above worked, you can check the '/etc/hosts' file.

  sudo gedit /etc/hostsYou should see the following line.

  127.0.1.1   testhost

Now we need to edit the Apache configuration file, so type into the console:

  sudo gedit /etc/apache2/httpd.confIn the resulting file (which may well be empty), add the definition for your host! My username is 'dan', and I want my webpages to be served from a directory named 'www' in my home, so I would add:

 
     ServerName testhost
     DocumentRoot /home/dan/www
 


where testhost is the name of the new virtual site (it must match the above entry in your conf file).

After this, you need to restart apache so it can load these new configuration file entries.

  sudo /etc/init.d/apache2 restartI can now add files to /home/dan/www, and access them by visiting http://testhost


Ik heb dit van deze site
Support bacteria. They're the only culture some people have.

lucky61

  • Gast
php script in firefox
« Reactie #5 Gepost op: 2008/07/11, 21:40:09 »
bedankt, Idefix!

ik begin het zo stilaan te snappen... of is dit een illusie? Hoe dan ook, een aangename ;-)

Luc