Jump to content

Recommended Posts

Posted

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.

Posted

Hmm.

 

Well, I didn't precisely forget; I never knew I had to add a question mark. I'll try that now.

 

Thanks.

Posted

Wonderful.

 

Now I get a 404 page instead. :)

Posted

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?)

Posted

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?

Posted (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 by TCH-MikeJ
Posted

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. :)

Posted

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. :)

Posted

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.

Posted

Use

<?php

for the 2nd line and

<!-- Googlebot Detection PHP -->

for the comments and it's almost identical to mine.

Posted

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

Posted

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?

Posted

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. :)

Posted

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.

Posted

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.

Posted

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.

Posted
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.

Posted

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.

Posted

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!

Posted

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.

Posted

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!)

Posted

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. :)

Posted

Is SmartFTP Mac-compatible? (Note that the other workarounds suggested do not apply here, being designed for a Windows environment.)

Posted

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.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...