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/httpdocs/DIRECTORY_1/DIRECTORY_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('/subscribers','',$_SERVER['PWD']);
define("D_INCLUDES", $path . "/includes/");

      require_once "../includes/hall.php";      
      require_once "../includes/template.class.php";
      require_once "../includes/mail.php";

$connection = DB::connect($dsn, true);
if (DB::isError($connection)) {
      trigger_error($connection->getMessage(), 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->getMessage(), E_USER_ERROR);
      }
while ($row = $result->fetchRow(DB_FETCHMODE_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
otto_chAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

gileze33Commented:
Hi.

Why are you running the file from shell?

Would be far easier to make the cron do wget http://server/file.php.
0
otto_chAuthor Commented:
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?
0
gileze33Commented:
No I mean you replace the URL.
0
Cloud Class® Course: CompTIA Cloud+

The CompTIA Cloud+ Basic training course will teach you about cloud concepts and models, data storage, networking, and network infrastructure.

otto_chAuthor Commented:
Sorry, perhaps I'm too stupid to understand.

Please, where should I replace which URL?
0
gileze33Commented:
I will re-write the script for you.
0
gileze33Commented:
Hi

Is this file on the web, so I can view it?
0
otto_chAuthor Commented:
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.
0
GranModCommented:
Closed, 500 points refunded.
GranMod
The Experts Exchange
Community Support Moderator of all Ages
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
PHP

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.