View previous topic :: View next topic |
Author |
Message |
Pricey81 -
Joined: 11 Jun 2007 Posts: 1
|
Posted: Mon Jun 11, 2007 1:40 pm Post subject: Running PHP with includes offline |
|
|
Hi,
I'm trying to run my website offline on my laptop (running vista) using Abyss Web Server. I've enabled PHP use with this.
When I open up my index.php it won't include the files I've asked it to, see my code:
Code: | <?php
include("nav.html");
?> |
Obviously nav.html is in the same directory.
Please can anyone help with this - I need ot get it working today :( :( |
|
Back to top |
|
 |
AbyssUnderground -
Joined: 31 Dec 2004 Posts: 3855
|
Posted: Mon Jun 11, 2007 2:08 pm Post subject: |
|
|
Are you sure PHP is configure correctly?
Run
Code: | <?php phpinfo(); ?> |
and see if you get an output.
If so then PHP is fine and the code is wrong (but it looks fine to me). Does the html file have anything in it? If so then change the filename in the code to one that does not exist and see if it gives you an error. If it does then php is fine but something else is not.
Report back your findings here so I can help you more. _________________ Andy (AbyssUnderground) (previously The Inquisitor)
www.abyssunderground.co.uk |
|
Back to top |
|
 |
rrinc -
Joined: 24 Feb 2006 Posts: 725 Location: Arkansas, USA
|
Posted: Mon Jun 11, 2007 6:55 pm Post subject: |
|
|
Also, include is a language construct, parenthesis are unnecessary.
Code: | <?php
include 'nav.html'; // also, PHP performs faster with single quotes
?> |
_________________ -Blake | New Server :D
SaveTheInternet
Soy hispanohablante. Puedes contactarme por mensajes privados. |
|
Back to top |
|
 |
AbyssUnderground -
Joined: 31 Dec 2004 Posts: 3855
|
Posted: Mon Jun 11, 2007 7:01 pm Post subject: |
|
|
How does PHP perform faster with single quotes? A single is just the same as a double quote. _________________ Andy (AbyssUnderground) (previously The Inquisitor)
www.abyssunderground.co.uk |
|
Back to top |
|
 |
rrinc -
Joined: 24 Feb 2006 Posts: 725 Location: Arkansas, USA
|
Posted: Mon Jun 11, 2007 7:15 pm Post subject: |
|
|
With double quotes PHP looks for strings and stuff.
Code: | $stuff = '123';
echo "$stuff"; // double quotes allow strings inside, php has to look for them
echo '$stuff'; // Will literally print '$stuff' and not the variable |
You can search it, single quotes with concatenation is faster than double quotes with strings inside. _________________ -Blake | New Server :D
SaveTheInternet
Soy hispanohablante. Puedes contactarme por mensajes privados.
Last edited by rrinc on Mon Jun 11, 2007 7:16 pm; edited 1 time in total |
|
Back to top |
|
 |
AbyssUnderground -
Joined: 31 Dec 2004 Posts: 3855
|
Posted: Mon Jun 11, 2007 7:16 pm Post subject: |
|
|
Ah I see, smart ;-) _________________ Andy (AbyssUnderground) (previously The Inquisitor)
www.abyssunderground.co.uk |
|
Back to top |
|
 |
marc2003 -
Joined: 04 Feb 2004 Posts: 15
|
Posted: Wed Jun 13, 2007 6:18 am Post subject: |
|
|
rrinc wrote: | single quotes with concatenation is faster than double quotes with strings inside. |
even though i didn't know that, it's the way i've alwys written my php. i just find it easier to read. |
|
Back to top |
|
 |
TRUSTAbyss -
Joined: 29 Oct 2003 Posts: 3752 Location: USA, GA
|
Posted: Wed Jun 13, 2007 5:13 pm Post subject: |
|
|
Basicly, what rrinc is say's is this... A string with single quotes will ignore variables within the string. However, with double quotes, it will search for all variables within that string and get the values, which may slow code execution. Concatenation is a good choice when dealing with single quotes. |
|
Back to top |
|
 |
|