Running PHP with includes offline

 
Post new topic   Reply to topic    Aprelium Forum Index -> PHP
View previous topic :: View next topic  
Author Message
Pricey81
-


Joined: 11 Jun 2007
Posts: 1

PostPosted: Mon Jun 11, 2007 1:40 pm    Post subject: Running PHP with includes offline Reply with quote

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 View user's profile Send private message
AbyssUnderground
-


Joined: 31 Dec 2004
Posts: 3855

PostPosted: Mon Jun 11, 2007 2:08 pm    Post subject: Reply with quote

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 View user's profile Send private message Visit poster's website
rrinc
-


Joined: 24 Feb 2006
Posts: 725
Location: Arkansas, USA

PostPosted: Mon Jun 11, 2007 6:55 pm    Post subject: Reply with quote

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 View user's profile Send private message Visit poster's website Yahoo Messenger MSN Messenger
AbyssUnderground
-


Joined: 31 Dec 2004
Posts: 3855

PostPosted: Mon Jun 11, 2007 7:01 pm    Post subject: Reply with quote

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 View user's profile Send private message Visit poster's website
rrinc
-


Joined: 24 Feb 2006
Posts: 725
Location: Arkansas, USA

PostPosted: Mon Jun 11, 2007 7:15 pm    Post subject: Reply with quote

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 View user's profile Send private message Visit poster's website Yahoo Messenger MSN Messenger
AbyssUnderground
-


Joined: 31 Dec 2004
Posts: 3855

PostPosted: Mon Jun 11, 2007 7:16 pm    Post subject: Reply with quote

Ah I see, smart ;-)
_________________
Andy (AbyssUnderground) (previously The Inquisitor)
www.abyssunderground.co.uk
Back to top View user's profile Send private message Visit poster's website
marc2003
-


Joined: 04 Feb 2004
Posts: 15

PostPosted: Wed Jun 13, 2007 6:18 am    Post subject: Reply with quote

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 View user's profile Send private message
TRUSTAbyss
-


Joined: 29 Oct 2003
Posts: 3752
Location: USA, GA

PostPosted: Wed Jun 13, 2007 5:13 pm    Post subject: Reply with quote

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 View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    Aprelium Forum Index -> PHP All times are GMT + 1 Hour
Page 1 of 1

 
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


Powered by phpBB phpBB Group