Jump to content

Cron Job! Seems to be something wrong with my php


Go to solution Solved by GetFreaky,

Recommended Posts

/home/oracle765/public_html/scripts/masters.php: line 1: ?: No such file or directory

Use <?php rather than just <?

 

Actually, add this at the top of the script:

 

#!/usr/bin/env php

 

 

/home/oracle765/public_html/scripts/masters.php: line 3: syntax error near unexpected token `('

Line should be

mysql_select_db('mydatabase') or die('Could not select database.<br>' . mysql_error());

although I'm not sure why you're using an HTML tag there.

Edited by boompa

To be able to run a file into a cron schedule make sure that the file has executable rights.

 

For the issue with .csv file, do you try to import the data from mysql command client line?

 

EDIT: What sql errors did you get running the script through the browser?

Edited by jazzman1

I tried putting /usr/bin/php -f /home/username/public_html/scripts/masters.php in the cron job but then the emails stopped coming through

 

I also tried typing http://www.compareandchoose.com.au/scripts/masters.php in the browser and ti also did not load the data into the database but just shows a blank screen as there is no html output

 

I am so lost as to what it could be because those ` parenthesis around $dbH don't even exist in my code

I tried putting /usr/bin/php -f /home/username/public_html/scripts/masters.php in the cron job but then the emails stopped coming through

 

I also tried typing http://www.compareandchoose.com.au/scripts/masters.php in the browser and ti also did not load the data into the database but just shows a blank screen as there is no html output

 

I am so lost as to what it could be because those ` parenthesis around $dbH don't even exist in my code

 

op are you sure your database credentials are correct

Edited by GetFreaky
  • Solution

What's the common b/w Apache and Cron? Cron could be run without php, mysql and apache at all. 

 

from OP

 

 

oh and I have tried running the webpage in the browser and when I go into the database it has not inserted the .csv file I have also put the full path in but that didn't work

 

 

 

I understood that the his query is faulty and doesn't generate the table values...

 

however mysql_error() should ouput if something is wrong, and its still blank page with no error.

 

Unless a new entry is inserted with blank values, then what I said above is irrelevant.

Edited by GetFreaky
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

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

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

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

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.