We build. You grow.

Get best community software here

Start a social network, a fan-site, an education project with oxwall - free opensource community software

getting a cron job to run in xp | Forum

Topic location: Forum home » Support » General Questions
Michael Leader
Michael Aug 17 '10
I have a small test pc in the garage, it runs a site for me and my email.

I decided to stick on oxwall to test.
After a little mucking I got the site up and running.
Now when I goto add a new test user I am promped for verification emails!
I know the cron job needs run to fire the message off from a hosted install and oxwall help.

How do ya do that in XP using Apache!

interwebly searches brough up a scheduled task running the cron "run.php" in internet explorer but I get a 404 when I do that.

Another suggestion was to schedule a tak using php to run another file to run the cron...

create a file called executerun.php
enter code

< ? p h p
$data = file("c:\Program Files\Apache Software Foundation\Apache2.2\htdocs\dev\ow_cron\run.php”);
?>


And save that beside the run.php in the same folder.

so the batch file I have says:
php.exe "c:\Program Files\Apache Software Foundation\Apache2.2\htdocs\dev\ow_cron\executerun.php"
pause


and that is supposed to fire the jobs off...

I get the error in cmd

C:\Documents and Settings>php.exe "c:\Program Files\Apache Software Foundation\A
pache2.2\htdocs\dev\ow_cron\executerun.php"
PHP Parse error: syntax error, unexpected $end in C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\dev\ow_cron\executerun.php on line 3

C:\Documents and Settings>pause
Press any key to continue . . .


I have attached the files in txt format for you to have a looky.
No major rush.
I'm just learning and playing... or am i going about this the wrong way!?!?!
The Forum post is edited by Michael Aug 17 '10
Attachments:
  cronbatch.bat.txt (0.13Kb)
  executerun.php.txt (0.1Kb)
Den Team
Den Aug 17 '10
Verification emails are sent directly from the code (bypassing cronjob), after successful user registration. That is because these emails are highly important for new users and should be sent immediately.
If it wasn't sent from your PC, there is something wrong with your "sendmail" program. And I would recommend you to check your php.ini settings and find out how your PHP sends emails.

Regarding Cronjob, you need to configure it anyway. For sending mass mailing, expiring user sessions, etc. You were on the right direction configuring it via Task Scheduler on Windows.
This error:
PHP Parse error: syntax error, unexpected $end in C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\dev\ow_cron\executerun.php on line 3
means that you have a syntax error in your code. In your executerun.php.txt file I can see the first tag as <?, but not as <?php. Probably, this is causing the error.
Also, PHP function file() just reads the content of a certain file, but does NOT execute it via PHP if you give it as an argument PATH (not URL) to php file. I suggest that you remove executerun.php, and paste the following content to cronbatch.bat:
cd..
cd..
c:\
cd php
php.exe "c:\Program Files\Apache Software Foundation\Apache2.2\htdocs\dev\ow_cron\run.php"
pause
The Forum post is edited by Den Aug 17 '10
Michael Leader
Michael Aug 20 '10
sorry, haven't had a chance to look at this. I will get back to it shortly...
TY for the help...
Michael Leader
Michael Aug 22 '10
I changed the batch to your suggestion and got the following error,

C:\Documents and Settings>php.exe "c:\Program Files\Apache Software Foundation\A
pache2.2\htdocs\dev\ow_cron\run.php"
PHP Fatal error: Class 'PDO' not found in C:\Program Files\Apache Software Foun
dation\Apache2.2\htdocs\dev\ow_core\database.php on line 163


My extension dir is correct, the needed dlls are present,
I have also extension=pdo.so in my INI

mysqlversion 5.1.26
php ver 5.2.6

No major rush on this. It is a development box local to my home. Just wanted to play... (but i would like some feedback...lol )
Press any key to continue . . .
Den Team
Den Aug 23 '10
It seems that PDO wasn't loaded during batch execution. You can simply check it:
- create phpinfo.php file with folowing content:
<?php
phpinfo();
?>

- run this file in your batch with this string:
php.exe "path_to_your_phpinfo_file"
- save output of this batch as HTML file and open it via browser. Try to find PDO extension on this file.
If it wasn't load, then it means that some extensions are not loading when PHP runs under Command Line. In this case you need learn how to enable this extensions for command line on your current LAMP installation.
The Forum post is edited by Den Aug 23 '10
Michael Leader
Michael Aug 23 '10
PM'd the info
But on looking, is phpinfo.php via web different from php.exe phpinfo.php???

I can find it in 1 but not the other.

(again no rush, this is a personal site, don't mind if work takes priority! LOL))
carlos
carlos Sep 3 '10
i used cpanel in a VPS ......