timtekk Posted January 5, 2011 Share Posted January 5, 2011 Hello. I've been running php 5.3.3 and apache 2.2.1.7 for a few weeks now and learning from a book I purchased. I've been writing code for a while now with no problems. Today I created a new directory in my www folder called CH2 (for chapter 2 in my book) and copied the sample code from the CD that came with the book, into this folder. When I execute php files from the browser from this new folder, they do not process. I see in my apache log this error: [Wed Jan 05 11:00:39 2011] [error] [client 127.0.0.1] File does not exist: C:/Dev, referer: http://localhost/ch2 I know 'file not found' sounds like a simple issue, but the thing is, I don't know what c:/Dev is... that folder does not exist on my C:\ drive at all. I don't know why it is looking there and what it is looking for. All of my other scripts that I have written in the past weeks work just fine, I have no problems with them. I would appreciate any help with this, thank you. Quote Link to comment https://forums.phpfreaks.com/topic/223500-apache-file-not-found-error-not-what-it-seems/ Share on other sites More sharing options...
jake2891 Posted January 5, 2011 Share Posted January 5, 2011 is it just one file or all? can you post your php file your trying to run from /ch2/foo.php. also are you using something like wamp etc? Quote Link to comment https://forums.phpfreaks.com/topic/223500-apache-file-not-found-error-not-what-it-seems/#findComment-1155319 Share on other sites More sharing options...
timtekk Posted January 5, 2011 Author Share Posted January 5, 2011 Hey Jake, yes I did install these items using WAMP. Honestly all of the php files in the ch2 folder are not working, here is an example of one of them: <html> <head> <title>Three Plus Five</title> </head> <body> <h1>Three Plus Five</h1> <h3>Demonstrates use of numeric variables</h3> <? $x = 3; $y = 5; print "$x + $y = "; print $x + $y; print "<br><br>"; print "$x - $y = "; print $x - $y; print "<br><br>"; print "$x * $y = "; print $x * $y; print "<br><br>"; print "$x / $y = "; print $x / $y; print "<br><br>"; ?> </body> </html> Thanks. Quote Link to comment https://forums.phpfreaks.com/topic/223500-apache-file-not-found-error-not-what-it-seems/#findComment-1155324 Share on other sites More sharing options...
jake2891 Posted January 5, 2011 Share Posted January 5, 2011 have you created the ch2 directory in your htdocs directory? seems like a silly question i know but u never know . does anything get displayed on the webpage in your browser when you open the page anything at all? Quote Link to comment https://forums.phpfreaks.com/topic/223500-apache-file-not-found-error-not-what-it-seems/#findComment-1155332 Share on other sites More sharing options...
timtekk Posted January 5, 2011 Author Share Posted January 5, 2011 Jake, when I click the php page, it displays all of the code in the browser, basically as though the browser is not processing the code from the php file. I see all of the variables as if I was looking at the code itself. Here is exactly what I see in the browser: Three Plus Five Demonstrates use of numeric variables "; print "$x - $y = "; print $x - $y; print " "; print "$x * $y = "; print $x * $y; print " "; print "$x / $y = "; print $x / $y; print " "; ?> As far as htdocs, I was under the impression that will WAMP all of my pages should be in \wamp\www folder... ? Could I be wrong? Quote Link to comment https://forums.phpfreaks.com/topic/223500-apache-file-not-found-error-not-what-it-seems/#findComment-1155347 Share on other sites More sharing options...
timtekk Posted January 5, 2011 Author Share Posted January 5, 2011 It's just strange, as I have all my other code in c:\wamp\www\my stuff and those items work. My book examples are in c:\wamp\www\my stuff\ch2 and those items don't work. I even tried putting the ch2 items in c:\wamp\www\ and they still don't work. Quote Link to comment https://forums.phpfreaks.com/topic/223500-apache-file-not-found-error-not-what-it-seems/#findComment-1155348 Share on other sites More sharing options...
PFMaBiSmAd Posted January 5, 2011 Share Posted January 5, 2011 Don't use short opening php tags <? in your code. Always use full opening php tags <?php Quote Link to comment https://forums.phpfreaks.com/topic/223500-apache-file-not-found-error-not-what-it-seems/#findComment-1155365 Share on other sites More sharing options...
timtekk Posted January 5, 2011 Author Share Posted January 5, 2011 Wow PFMaBiSmAd, that was it. Unreal. I thought <? was allowed? Either way whatever, thank you so much for shedding light on that. Quote Link to comment https://forums.phpfreaks.com/topic/223500-apache-file-not-found-error-not-what-it-seems/#findComment-1155369 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.