xdeamon Posted August 31, 2011 Share Posted August 31, 2011 Hi guys I get this warning when testing out code in xampp Warning: Division by zero in C:\xampp\htdocs then it continues; Warning: Division by zero in C:\xampp\htdocs\TFN\index.php on line 25 Warning: include(C:\xampp\php\PEAR\PHP) [function.include]: failed to open stream: Permission denied in C:\xampp\htdocs\TFN\index.php on line 25 Warning: include() [function.include]: Failed opening 'php' for inclusion (include_path='.;C:\xampp\php\PEAR') in C:\xampp\htdocs\TFN\index.php on line 25 Warning: Division by zero in C:\xampp\htdocs\TFN\index.php on line 27 Warning: include(C:\xampp\php\PEAR\PHP) [function.include]: failed to open stream: Permission denied in C:\xampp\htdocs\TFN\index.php on line 27 Warning: include() [function.include]: Failed opening 'php' for inclusion (include_path='.;C:\xampp\php\PEAR') in C:\xampp\htdocs\TFN\index.php on line 27 ...... I have used the search function but all the results are similar but i cant find one that fits/ solves my issue hence the new thread, so apologies in advance. Please note im trying to get to grips with php and i havent done any wed design in 10 yrs or so, so bear with me if i seem idiotic at times lol i followed this basic tutorial from here: http://www.1stwebdesigner.com/css/how-to-create-php-website-template/ Then was going to edit / add as needed but after getting to the final stage and testing it... The above error appeared. so u can see what i see here is a link to my site: http://tfn.site11.com/ here is my folder/file structure root css folder/ css file includes folder/ footer.php/header.php/nav.php/sidebar.php variables folder/ variables.php index.php If you need to know anything else just ask.. Thanks for your time Quote Link to comment Share on other sites More sharing options...
AyKay47 Posted August 31, 2011 Share Posted August 31, 2011 can you post the relevant code.. Quote Link to comment Share on other sites More sharing options...
xdeamon Posted August 31, 2011 Author Share Posted August 31, 2011 im not sure code u'll need im assuming u'll need the index.php code: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <meta name="description" content="" /> <meta name="keywords" content="" /> <meta name="author" content="" /> <link rel="stylesheet" type="text/css" href="style.css" media="screen" /> <title>Top Form Nails</title> </head> <body> <div id="wrapper"> <?php include(‘includes/header.php); ?> <?php include(includes/nav.php); ?> <div id="content"> <h1>Heading1</h1> <h2>Heading2</h2> <h3>Heading3</h3> <h4>Heading4</h4> <h5>Heading5</h5> <h3>Paragraph Element</h3> <p> Quisque pellentesque sodales aliquam. Morbi mollis neque eget arcu egestas non ultrices neque volutpat. Nam at nunc lectus, id vulputate purus. In et turpis ac mauris viverra iaculis. Cras sed elit a purus ultrices iaculis eget sit amet dolor. Praesent ac libero dolor, id viverra libero. Mauris aliquam nibh vitae eros sodales fermentum. Fusce cursus est varius ante vehicula eget ultrices felis eleifend. Nunc pharetra rutrum nibh et lobortis. Morbi vitae venenatis velit. </p> <p> Quisque pellentesque sodales aliquam. Morbi mollis neque eget arcu egestas non ultrices neque volutpat. Nam at nunc lectus, id vulputate purus. In et turpis ac mauris viverra iaculis. Cras sed elit a purus ultrices iaculis eget sit amet dolor. Praesent ac libero dolor, id viverra libero. Mauris aliquam nibh vitae eros sodales fermentum. Fusce cursus est varius ante vehicula eget ultrices felis eleifend. Nunc pharetra rutrum nibh et lobortis. Morbi vitae venenatis velit. </p> <h3>Another Heading Starting Point</h3> <p> Quisque pellentesque sodales aliquam. Morbi mollis neque eget arcu egestas non ultrices neque volutpat. Nam at nunc lectus, id vulputate purus. In et turpis ac mauris viverra iaculis. Cras sed elit a purus ultrices iaculis eget sit amet dolor. Praesent ac libero dolor, id viverra libero. Mauris aliquam nibh vitae eros sodales fermentum. Fusce cursus est varius ante vehicula eget ultrices felis eleifend. Nunc pharetra rutrum nibh et lobortis. Morbi vitae venenatis velit. </p> <p> Quisque pellentesque sodales aliquam. Morbi mollis neque eget arcu egestas non ultrices neque volutpat. Nam at nunc lectus, id vulputate purus. In et turpis ac mauris viverra iaculis. Cras sed elit a purus ultrices iaculis eget sit amet dolor. Praesent ac libero dolor, id viverra libero. Mauris aliquam nibh vitae eros sodales fermentum. Fusce cursus est varius ante vehicula eget ultrices felis eleifend. Nunc pharetra rutrum nibh et lobortis. Morbi vitae venenatis velit. </p> </div> <!– end #content –> <?php include(‘includes/sidebar.php’); ?> <?php include(‘includes/footer.php’); ?> </div> <!– End #wrapper –> </body> </html> Quote Link to comment Share on other sites More sharing options...
xdeamon Posted August 31, 2011 Author Share Posted August 31, 2011 Anyone????? Quote Link to comment Share on other sites More sharing options...
Psycho Posted August 31, 2011 Share Posted August 31, 2011 These are lines 25 - 27 <?php include(`includes/header.php); ?> <?php include(includes/nav.php); ?> The first include is using a "back tick" before the file name and is missing a quote at the end of the file name and the second include is missing both quotes around the file name. You need to enclose the file names in single or double quotes ( ' or "). The division by zero is probably because the incorrect or missing quotes is causing it to try an interpret the '/' as a division. Try: <?php include('includes/header.php'); ?> <?php include('includes/nav.php'); ?> Quote Link to comment Share on other sites More sharing options...
xdeamon Posted September 1, 2011 Author Share Posted September 1, 2011 These are lines 25 - 27 <?php include(`includes/header.php); ?> <?php include(includes/nav.php); ?> The first include is using a "back tick" before the file name and is missing a quote at the end of the file name and the second include is missing both quotes around the file name. You need to enclose the file names in single or double quotes ( ' or "). The division by zero is probably because the incorrect or missing quotes is causing it to try an interpret the '/' as a division. Try: <?php include('includes/header.php'); ?> <?php include('includes/nav.php'); ?> Thanks that worked perfectly, ive fixed my header nav sidebar and footer issues. I am getting this errror tho: Warning: Division by zero in C:\xampp\htdocs\TFN\includes\header.php on line 1 Warning: include(php’) [function.include]: failed to open stream: No such file or directory in C:\xampp\htdocs\TFN\includes\header.php on line 1 Warning: include() [function.include]: Failed opening 'php’' for inclusion (include_path='.;C:\xampp\php\PEAR') in C:\xampp\htdocs\TFN\includes\header.php on line 1 Both above the header and below the footer... what does it mean because in line 1 everything looks okany ideas? Thanks Quote Link to comment Share on other sites More sharing options...
AyKay47 Posted September 1, 2011 Share Posted September 1, 2011 what does header.php look like? Quote Link to comment Share on other sites More sharing options...
xdeamon Posted September 1, 2011 Author Share Posted September 1, 2011 <?php include(‘variables/variables.php’); ?> <div id="header"> <h2><?php echo $heading ?></h2> </div> <!– end #header –> Quote Link to comment Share on other sites More sharing options...
AyKay47 Posted September 1, 2011 Share Posted September 1, 2011 <?php include("variables/variables.php"); ?> <div id="header"> <h2><?php echo $heading ?></h2> </div> <!– end #header –> Quote Link to comment Share on other sites More sharing options...
xdeamon Posted September 1, 2011 Author Share Posted September 1, 2011 <?php include("variables/variables.php"); ?> <div id="header"> <h2><?php echo $heading ?></h2> </div> <!– end #header –> Thank Man all sorted Quote Link to comment Share on other sites More sharing options...
Psycho Posted September 1, 2011 Share Posted September 1, 2011 @xdeamon: Just to be clear, the problem was not because you were using single quotes. Both the strait single quote (') and the strait double quote (") are both perfectly valid for enclosing strings. Those are the characters just to the left of the enter key (on a standard US keyboard). But, in your original code and in the code for the header you had single "left" (or back) and "right" (or forward) quotes. The single left-quote is the character on the top left of your keyboard, just below the ESC key. But, there is no easy way to enter the right quote. But, both of those special types of quotes are commonly automatically entered in word-processing application, such as MS Word. Any application made for writing code will not do this. You are apparently using a program for creating/editing your code that was not meant to do that. Get a good application for writing code and use it. There are many that have great features for making code writing much easier (auto-complete for functions, tips on parameters needed, automatic indentation, etc.) Quote Link to comment Share on other sites More sharing options...
xdeamon Posted September 1, 2011 Author Share Posted September 1, 2011 I am using dreamweaver. But I copied and pasted the php parts and didnt notice the ' instead of ". I apologise for being stupid. Thanks for your help Quote Link to comment Share on other sites More sharing options...
Psycho Posted September 1, 2011 Share Posted September 1, 2011 I am using dreamweaver. But I copied and pasted the php parts and didnt notice the ' instead of ". You didn't read what I just said: there is nothing wrong with single or double quotes - but they must be "strait" quotes. I.e. they cannnot be the left/right slanted quotes: These are OK: ' " These are NOT OK: ‘ ’ “ ” Quote Link to comment Share on other sites More sharing options...
xdeamon Posted September 1, 2011 Author Share Posted September 1, 2011 ahh i see now ty and apologies Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.