Page 1 of 1
Extreme noob with a problem
Posted: Sat Aug 29, 2009 8:21 am
by Zepped
Hello all, I have an issue with trying to run a cron job. When it runs, I get these errors:
/admin/autoupdate.php: line 1: ?php: No such file or directory
/admin/autoupdate.php: line 2: syntax error near unexpected token `"../includes/common.php"'
/autoupdate.php: line 2: `include("../includes/common.php");'
For the line 1 error, I checked the folders and files as the script seems to be calling for and they all do exist, so I'm totally lost. Here's the first lines of the script in question:
Code: Select all
<?php
include("../includes/common.php");
$currdate=date("Y-m-d");
//to set expired in extended ad
$q1="select * from $adm_postad where exexpdate='$currdate'";
$res1=mysql_query($q1,$con)
Any ideas would be greatly appreciated!
Sdt
Re: Extreme noob with a problem
Posted: Sat Aug 29, 2009 11:30 am
by Zepped
Hi and thanks for the reply. Not sure I know how to answer that, but I used the Standard Cron Manager from my hosts control panel to set up the execution intervals and put this in the "command to run line" /home/mydomain/public_html/classifieds/admin/autoupdate.php (autoupdate.php is where the code snippet I posted above is from).
I am new to this, usually, I install scripts that I've bought (as in this case) and they work fine. From time to time I need to go into stuff and poke around but never actually had to "fix" a scripting problem. I guess it's time to learn and I do appreciate your help.
Sdt
Re: Extreme noob with a problem
Posted: Sat Aug 29, 2009 11:41 am
by stratbeans
The problem you are facing is because the cron is not able to identify and execute the php file.
If you are online PM me and we can interactively debug this issue.
Re: Extreme noob with a problem
Posted: Sat Aug 29, 2009 4:28 pm
by Zepped
Hiya stratbeans, thank you but of course I wasn't here when you were! I was out doing a little research and found a suggestion that I needed to put a "php" in front of the command line, which I did. I ran the cron again and got this output:
X-Powered-By: PHP/5.2.5
Content-type: text/html
Does that mean it's working? It appears that the expired ads still show up however, (it's a classified ads program and this cron job is supposed to remove expired ads). I dunno, it's so confusing to my poor little grey matter.
Re: Extreme noob with a problem
Posted: Sat Aug 29, 2009 4:32 pm
by Darhazer
Yes it was run, but your code (if you've posted the whole code of course) only selects data from the database, it does not remove anything.
Re: Extreme noob with a problem
Posted: Sat Aug 29, 2009 4:35 pm
by Zepped
Thank you Darhazer. I only posted a small portion of the code. Is it legal/moral to post the whole code since it is the work of someone else?
Thanks again!
Re: Extreme noob with a problem
Posted: Sat Aug 29, 2009 7:32 pm
by califdon
I sure wouldn't base an ad expiration system on a cron job. In fact, I can't think of any functionality that I would base on a cron job, other than data backups. Each ad in your database should have an expiration date that you check when you serve the ads.
Re: Extreme noob with a problem
Posted: Sun Aug 30, 2009 9:30 am
by Zepped
It's all part of the software that I bought as far as the cron removing expired ads. It seems to not be removing them. I posted 3 test ads and selected a 5 day duration. They are all well over the duration and it appears that the autoupdate.php is running without producing a visible error, but the old ads are still present in the classifieds listings. I tried to contact the software creator, but they don't reply to trouble tickets so well. Is it possible that since these ads were placed and expired before the autoupdate.php was able to run successfully that they are being overlooked?
Re: Extreme noob with a problem
Posted: Sun Aug 30, 2009 11:22 am
by califdon
Zepped wrote:It's all part of the software that I bought as far as the cron removing expired ads. It seems to not be removing them. I posted 3 test ads and selected a 5 day duration. They are all well over the duration and it appears that the autoupdate.php is running without producing a visible error, but the old ads are still present in the classifieds listings. I tried to contact the software creator, but they don't reply to trouble tickets so well. Is it possible that since these ads were placed and expired before the autoupdate.php was able to run successfully that they are being overlooked?
Absolutely anything is possible. I'm afraid that's the risk of buying software (or using freeware) that doesn't have a wide reputation. I surely understand why a non-programmer would do so, but it often produces the results you are experiencing: a poorly designed application with little or no after-market support. It's easy for me to say this and much harder for someone else to follow, but if there isn't a reliable application available from a recognized software producer that meets your requirements, your best route is to hire a developer who will be responsible for its satisfactory performance (which is what you very well may have to do, anyway). More expensive? Yes, but you will save a lot of your time and distraction, and have exactly what you want.
Re: Extreme noob with a problem
Posted: Mon Aug 31, 2009 3:18 pm
by Zepped
Thanks for all the replies. Maybe it's time to buy a book or two and learn this language. Any good suggestions on a php book(s) for a total beginner?
Sdt