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

  • SEARCH
  • Home
  • 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 9177229
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T17:16:33+00:00 2026-06-17T17:16:33+00:00

I am running a cronjob that runs a PHP script to do a couple

  • 0

I am running a cronjob that runs a PHP script to do a couple of things; first, it opens the database and stores the contents of the tables into memcache; second it creates a Javascript file that is basically a couple of arrays so that the client browser can do a lot of the work and save the server from being overloaded. This is newly added.

The script runs manually very well, and for over a year it has done its job, updating memcache every 10 minutes. The Javascript file add on is the big problem here; the cronjob s/b creating a new, updated edition of this file every 10 minutes, but appears to be not working unless I run it manually from the command line.

I can check this by doing:

ls -al id_index.js  

and checking the timestamp in the file listing.

Is there some problem with creating a Javascript file from a script started by crontab?

Btw, the cronjob file entry looks like this:

# m h  dom mon dow   command
*/10 * * * * php /home/accountname/public_html/mc_store_arrays.php

Any and all help is appreciated.

  • 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-17T17:16:35+00:00Added an answer on June 17, 2026 at 5:16 pm

    In which directory are you expecting the javascript file to be created? It probably is being created somewhere … wherever cron’s working directory happens to be when the script runs (/root/ perhaps?). Make sure your output file is specified with an absolute path or with e.g:

    file_put_contents(__DIR__ . '/id_index.js', $content);
    

    which will create the file based on the path of the php script that’s running, rather than the path from which it was executed.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm running a cronjob that calls a php script. I get failed to open
I have a PHP script that has been running as a cron job. The
I have a PHP script that runs a SELECT query then immediately deletes the
Running my script through Devel::NYTProf showed that the following portion of code took up
I want to create cron job that runs a script every 5 seconds. Seeing
I have a script that runs from a cron job every night. Recently, it
I have 1 cronjob that runs every 60 minutes but for some reason, recently,
I'm looking for PHP solutions for running cronjobs over multiple servers and guaranteeing that
I have a bash script running on my Mac that uses cURL to upload
I want to make a bash script that echo's something into one of the

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.