Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8566133
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T17:35:11+00:00 2026-06-11T17:35:11+00:00

I am trying to get crontab to run a php file, here is the

  • 0

I am trying to get crontab to run a php file, here is the cronjob

10 * * * * /usr/bin/php  /var/www/update/ranks.php >> /var/www/update/log/ranks.txt

But I keep getting an error saying the required file does not exist

PHP Warning:  require_once(../mws_products.php): failed to open stream: No such file or directory in /var/www/update/ranks.php on line 2
PHP Fatal error:  require_once(): Failed opening required '../mws_products.php' (include_path='.:/usr/share/php:/usr/share/pear') in /var/www/update/ranks.php on line 2

I do not get this problem when I run the file from a browser or when I go into the directory of the file and execute the file e.g. cd /var/www/update/

ranks.php

<?php 
require_once('../mws_products.php');

echo "-------------------------------------------------------------\n";
echo date('d-M-Y H:i:s',time())."\n";
echo "Update Ranks\n";
$products->updateRanks();
$database->addUpdate("ranks", time());
echo "\n\n\n";
?>

folder structure

[folder] update
   |____ [file] ranks.php

[file]   mws_products.php

What could be causing this problem? (note: I have tried restarting apache and the server)

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T17:35:13+00:00Added an answer on June 11, 2026 at 5:35 pm

    As your are running in a crontab from the root directory ../mws_pruducts.php does not exists, relative to the given root.

    There are multiple solutions, this is one of them:

    define( 'ROOT', dirname(__FILE__) );  
    require_once(ROOT . '/../mws_products.php');
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying get my head around how you can run the following php:
I am trying to get a cronjob to pipe output into a dated file
I am trying to run a crontab on Ubuntu, I think I get the
I am trying to write an php twitter script which will be run by
I've been trying to get crontab to work for a while but it doesnt
Here's a snippet of a bash script I'm writing to log CPU loads: #!/bin/bash
I'm trying get value of var by its name: var1='Hello' var2 = getTextFromFirstTextBox() //text
in my app i am trying to get an xml file from an URL.
I'm trying to simulate a socket client using simple perl program. socket client: #!/usr/bin/perl
I'm trying to get a crontab working for Cakephp (running on my shared Dreamhost

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.