otto_ch
asked on
mail_cron.php doesn't work
Requirements: MySQL, PHP5, Webserver Apache/2.0.46 (CentOS)
Apache-CronJob is installed and works (proofed by logs):
-----
#!/bin/bash
cd /home/httpd/vhosts/DOMAIN. com/httpdo cs/DIRECTO RY_1/DIREC TORY_2
./mail_cron.php
-----
The problem seems to be in the script mail_cron.php (see below).
As programmer says it works on a Linux-server, but it doesn't execute on Apache.
Who can tell-me something about the possible reason?
-------------------------- ----
#!/usr/bin/php
<?php
$path=str_replace('/subscr ibers','', $_SERVER[' PWD']);
define("D_INCLUDES", $path . "/includes/");
require_once "../includes/hall.php";
require_once "../includes/template.clas s.php";
require_once "../includes/mail.php";
$connection = DB::connect($dsn, true);
if (DB::isError($connection)) {
trigger_error($connection- >getMessag e(), E_USER_ERROR);
}
$query="select mem_sub_id sub_id, memo.ID mem_id, sub_language
from memo, subscribers
where (mem_expiry=now()-interval 10 day or mem_expiry=now()-interval 1 month)
and mem_sub_id=subscribers.ID order by sub_language";
//echo "\n\n\n $query \n\n\n";
$result = $connection->query($query) ;
if (DB::isError($result)) {
trigger_error($result->get Message(), E_USER_ERROR);
}
while ($row = $result->fetchRow(DB_FETCH MODE_ASSOC ))
{
$sl=$row['sub_language'];
if ($sl!=$_SESSION['lang'])
{
$_SESSION['lang']=$sl;
LoadLangSpecific();
}
$sub_id=$row['sub_id'];
$mem_id=$row['mem_id'];
MailConfiramtion($sub_id, $mem_id, T_COMMEMORATE);
}
?>
-------------------------- ----
Thanks for any help!
Otto
Apache-CronJob is installed and works (proofed by logs):
-----
#!/bin/bash
cd /home/httpd/vhosts/DOMAIN.
./mail_cron.php
-----
The problem seems to be in the script mail_cron.php (see below).
As programmer says it works on a Linux-server, but it doesn't execute on Apache.
Who can tell-me something about the possible reason?
--------------------------
#!/usr/bin/php
<?php
$path=str_replace('/subscr
define("D_INCLUDES", $path . "/includes/");
require_once "../includes/hall.php";
require_once "../includes/template.clas
require_once "../includes/mail.php";
$connection = DB::connect($dsn, true);
if (DB::isError($connection))
trigger_error($connection-
}
$query="select mem_sub_id sub_id, memo.ID mem_id, sub_language
from memo, subscribers
where (mem_expiry=now()-interval
and mem_sub_id=subscribers.ID order by sub_language";
//echo "\n\n\n $query \n\n\n";
$result = $connection->query($query)
if (DB::isError($result)) {
trigger_error($result->get
}
while ($row = $result->fetchRow(DB_FETCH
{
$sl=$row['sub_language'];
if ($sl!=$_SESSION['lang'])
{
$_SESSION['lang']=$sl;
LoadLangSpecific();
}
$sub_id=$row['sub_id'];
$mem_id=$row['mem_id'];
MailConfiramtion($sub_id, $mem_id, T_COMMEMORATE);
}
?>
--------------------------
Thanks for any help!
Otto
ASKER
Hello Gileze33
Sorry, I didn't understand your command.
http://server/file.php
leads to
http://www.songtext.net/
What would-you like to show me there?
Sorry, I didn't understand your command.
http://server/file.php
leads to
http://www.songtext.net/
What would-you like to show me there?
No I mean you replace the URL.
ASKER
Sorry, perhaps I'm too stupid to understand.
Please, where should I replace which URL?
Please, where should I replace which URL?
I will re-write the script for you.
Hi
Is this file on the web, so I can view it?
Is this file on the web, so I can view it?
ASKER
No it isn't.
But meantime we solved the problem!
By changing the intro of the script and specifying some paths:
-------------------------- ----
<?php
require_once $_SERVER['DOCUMENT_ROOT'] . '/user/includes/hall.php';
require_once I_VALIDATE;
require_once I_MAIL;
require_once I_TEMPLATE;
$connection = DB::connect($dsn, true);
...
[The rest of the script is the same like reported in the question posting (above).]
Thank you anyway.
But meantime we solved the problem!
By changing the intro of the script and specifying some paths:
--------------------------
<?php
require_once $_SERVER['DOCUMENT_ROOT'] . '/user/includes/hall.php';
require_once I_VALIDATE;
require_once I_MAIL;
require_once I_TEMPLATE;
$connection = DB::connect($dsn, true);
...
[The rest of the script is the same like reported in the question posting (above).]
Thank you anyway.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Why are you running the file from shell?
Would be far easier to make the cron do wget http://server/file.php.