Boojum Posted May 18, 2004 Share Posted May 18, 2004 I just tried to upload the new version (at long last) of my site. I began by deleting the old pages, so there'd be no confusion. Then I uploaded the pages in my FTP client, making sure that all the files were in place. BUT: When I tried to access my index page, I got this: "Parse error: parse error in /home/squortc/public_html/index.php on line 313." Does anyone know what's going on here ... and, more importantly, how I can correct it? As it stands, my site does not effectively exist at all. Quote Link to comment Share on other sites More sharing options...
TCH-Thomas Posted May 18, 2004 Share Posted May 18, 2004 Did you forget the >?> at end? That message appeared when i forgot it once. Quote Link to comment Share on other sites More sharing options...
Boojum Posted May 18, 2004 Author Share Posted May 18, 2004 Hmm. Well, I didn't precisely forget; I never knew I had to add a question mark. I'll try that now. Thanks. Quote Link to comment Share on other sites More sharing options...
Boojum Posted May 18, 2004 Author Share Posted May 18, 2004 Wonderful. Now I get a 404 page instead. Quote Link to comment Share on other sites More sharing options...
Boojum Posted May 18, 2004 Author Share Posted May 18, 2004 Incidentally, what sort of filename should I be using? Should it be, e.g., "...index.php?", "...index.php?>", or what? (And I suppose that'll have to be used for all the links to those pages as well?) Quote Link to comment Share on other sites More sharing options...
Deverill Posted May 18, 2004 Share Posted May 18, 2004 The 404 is saying there is no file in your www/ folder named index.php or .htm or .html unless your .htaccess is broken. Are you sure your filename is index.php and it's in the www folder? Quote Link to comment Share on other sites More sharing options...
MikeJ Posted May 18, 2004 Share Posted May 18, 2004 (edited) "Parse error: parse error in /home/squortc/public_html/index.php on line 313." This simply means there's a syntax error in the PHP code within that file (which Thomas was sort of trying to elude to, as he was referencing within the file, not the the filename). "index.php" is a correct name for the file. The only way to correct it is to fix the code in the file. Without seeing the contents, we can't really help beyond that. Edited May 18, 2004 by TCH-MikeJ Quote Link to comment Share on other sites More sharing options...
Boojum Posted May 18, 2004 Author Share Posted May 18, 2004 1) Jim: I have uploaded all my files, from the beginning, to the public_html folder, not the www folder. Does this need to be changed for a .php file? 2) MikeJ: Hmm. The only actual php in the file is code I copied from this forum (to have Googlebot visits reported to me via e-mail). Is that likely to be the source of the problem? ----------------------------------------------------- I hope to solve this issue soon; my entire site is effectively nonexistent right now. Quote Link to comment Share on other sites More sharing options...
Deverill Posted May 18, 2004 Share Posted May 18, 2004 public_html is a link to www (or vice versa), they end up the same place so there's no problem there. Make sure you submit a helpdesk ticket with the username password so the techs can get to the bottom quicker than we can without it. Quote Link to comment Share on other sites More sharing options...
Boojum Posted May 18, 2004 Author Share Posted May 18, 2004 Aha! It appears that the php part is the source of the problem. Can anyone see the fatal flaw in the following code? <! GOOGLEBOT DETECTION PHP> <? if(eregi("googlebot",$HTTP_USER_AGENT)) { if ($QUERY_STRING != "") {$url = "http://".$SERVER_NAME.$PHP_SELF.'?'.$QUERY_STRING;} else {$url = "http://".$SERVER_NAME.$PHP_SELF;} $today = date("F j, Y, g:i a"); mail("pointzero@neteze.com", "Googlebot detected on http://$SERVER_NAME", "$today - Google crawled $url"); } ?> <! END GOOGLEBOT DETECTION PHP> If not, perhaps I'll just delete the code from all my pages. But if anyone can help me fix the above code, it would be appreciated; the Googlebot notification would be a useful addition. Quote Link to comment Share on other sites More sharing options...
Deverill Posted May 18, 2004 Share Posted May 18, 2004 Use <?php for the 2nd line and <!-- Googlebot Detection PHP --> for the comments and it's almost identical to mine. Quote Link to comment Share on other sites More sharing options...
MikeJ Posted May 18, 2004 Share Posted May 18, 2004 Yea (good thing I previewed before posting... like 4 posts came up while I was on the phone. ) Do the changes Jim mentioned and you should be golden. Thumbs Up Quote Link to comment Share on other sites More sharing options...
Boojum Posted May 18, 2004 Author Share Posted May 18, 2004 Jim: I tried substituting the exact phrases you suggested, but I still get the same error message. Is there anything else that I might need to change? Quote Link to comment Share on other sites More sharing options...
Boojum Posted May 18, 2004 Author Share Posted May 18, 2004 The script now reads: <!-- Googlebot Detection PHP --> <?php if(eregi("googlebot",$HTTP_USER_AGENT)) { if ($QUERY_STRING != "") {$url = "http://".$SERVER_NAME.$PHP_SELF.'?'.$QUERY_STRING;} else {$url = "http://".$SERVER_NAME.$PHP_SELF;} $today = date("F j, Y, g:i a"); mail("pointzero@neteze.com", "Googlebot detected on http://$SERVER_NAME", "$today - Google crawled $url"); } ?> <! --END GOOGLEBOT DETECTION PHP --> But I still get the same error. Quote Link to comment Share on other sites More sharing options...
TCH-Rick Posted May 18, 2004 Share Posted May 18, 2004 I looked at the files on the server and they are hard to read as the php files are all on one line with ^M for carriage returns. Makes it hard to find line 313 or whatever. I would suggest uploading them again and make sure it is in ASCII mode. One of the coding gurus maybe able to advise further on making sure the files are uploaded so that each line is separated. It is a coding issue and there is not much we would be able to do from the Help Desk. Quote Link to comment Share on other sites More sharing options...
Boojum Posted May 18, 2004 Author Share Posted May 18, 2004 Rick: I have uploaded the file I'm currently testing several times, and I'm sure it's in ASCII mode; however, the line numbers vary by file anyway. The problem has been isolated as occurring in the php script shown in my previous posts. Therefore, there must presumably be something wrong with the code as cited. Trouble is, no one seems to have fingered the culprit yet. Oh, well. The script would provide a useful service, but it is hardly essential. I need to get some rest (I've been up all night ... again), but when I return, if there doesn't seem to be a better suggestion, I'll just delete the code from all my pages and upload them again. Quote Link to comment Share on other sites More sharing options...
scotttyz Posted May 18, 2004 Share Posted May 18, 2004 could you let us know what line is #313 (or whatever line the error is saying) and that will help a ton Quote Link to comment Share on other sites More sharing options...
Boojum Posted May 18, 2004 Author Share Posted May 18, 2004 Not without manually counting lines—and my eyes are far too tired for that. Again, though: The code is exactly as I presented it. There are only a few lines there. I would hope we could somehow isolate the problem without counting lines in my pages. Quote Link to comment Share on other sites More sharing options...
MikeJ Posted May 18, 2004 Share Posted May 18, 2004 Again, though: The code is exactly as I presented it. There are only a few lines there. I would hope we could somehow isolate the problem without counting lines in my pages. The problem is there isn't anything wrong with that code. I cut and paste it, exactly as you had it posted above, into a dummy page and I don't get any errors. Something else in the page would appear to be causing the problem. Quote Link to comment Share on other sites More sharing options...
TCH-Rick Posted May 18, 2004 Share Posted May 18, 2004 The problem is not in the code you copied, the problem is in the way the code is on the server. As I mentioned earlier, when I look at the code on the server it all appears on one line using ^M as carriage returns rather than separate lines. I editted the last section of the code and found that it also had a stray character uploaded where there was supposed to be a space at the beginning of the lines: if ($QUERY_STRING != "") {$url = "http://".$SERVER_NAME.$PHP_SELF.'?'.$QUERY_STRING;} else {$url = "http://".$SERVER_NAME.$PHP_SELF;} This is what appears on the server (except it is all on one line): if ($QUERY_STRING != "")^MÊ{$url = "http://".$SERVER_NAME.$PHP_SELF.'?'.$QUERY_STRING;}^Melse^MÊ{$url = "http://".$SERVER_NAME.$PHP_SELF;}^M Notice the Ê that appears twice. I'm guessing this is where the parse errors are occurring. I fixed the end section of the file called by the Santa Cruz link and it is working now. I saved the old file as indexold.php. Quote Link to comment Share on other sites More sharing options...
Deverill Posted May 19, 2004 Share Posted May 19, 2004 Great work, Rick! That would be a nightmare to find. What are you using to upload the files, Booj? There's something squirrely in there because it shouldn't come out like Rick described if it's really doing the Ascii thing unless it's on your hard drive that way. What editor are you using? Does it support Mac/PC/Unix end-of-line (CR versus CRLF)? I'm just throwing out things that come to mind. I used to work a lot with unix and it did that kind of thing to me sometimes. Hope it helps - don't give up! Quote Link to comment Share on other sites More sharing options...
Boojum Posted May 19, 2004 Author Share Posted May 19, 2004 I'm using Fetch (don't know if you're familiar with it) as my FTP program. Now the question is: How do I go about actually correcting this parsing problem? For the moment, I have decided simply to remove the code. If someone can suggest a way to repair it, I may try reinstalling it later, but for now it is more important to have working pages. Thanks for your suggestions in any case. Quote Link to comment Share on other sites More sharing options...
TCH-Rick Posted May 19, 2004 Share Posted May 19, 2004 I'm not sure that Fetch is the problem. What program are you using to actually edit the code? Quote Link to comment Share on other sites More sharing options...
Boojum Posted May 19, 2004 Author Share Posted May 19, 2004 BBEdit Lite 6.1. Which has been fairly reliable so far, to my knowledge. Fetch, on the other hand, is more than a bit suspect. Nonetheless, if anyone can offer me a good, practical solution to this issue, it would be most appreciated; I would eventually like to track Googlebot's visits. (Meanwhile, I deleted the php scripts from the pages and re-uploaded them, and they appear to work as designed. woooot Nearly killed myself doing it, but the new version is up. Come check it out!) Quote Link to comment Share on other sites More sharing options...
Deverill Posted May 19, 2004 Share Posted May 19, 2004 With your doubts about fetch you could get something like SmartFTP or use the dos command line ftp if you're familiar with that just to see how it works out for you. If it works then go back to Fetch and try one more time. If it breaks then Add/Remove Programs it. Quote Link to comment Share on other sites More sharing options...
Boojum Posted May 19, 2004 Author Share Posted May 19, 2004 Is SmartFTP Mac-compatible? (Note that the other workarounds suggested do not apply here, being designed for a Windows environment.) Quote Link to comment Share on other sites More sharing options...
Deverill Posted May 19, 2004 Share Posted May 19, 2004 SmartFTP is available in PC-only flavor. I had about 10 minutes today to set up a mac and couldn't even figure, in that amount of time, how to do a ping so I can't help you with whether there is an equivalent built-in ftp utility. The principle is the same, if you doubt your utility get another one and try it. Quote Link to comment Share on other sites More sharing options...
TCH-Rob Posted May 19, 2004 Share Posted May 19, 2004 download.com There should be a few that you can try. Quote Link to comment Share on other sites More sharing options...
MikeJ Posted May 19, 2004 Share Posted May 19, 2004 I personally use Transmit ( http://www.panic.com/transmit/ - not free, but free trial available ). There are other good apps, though, like even CuteFTP has a Mac version. 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.