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 8903521
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T01:53:23+00:00 2026-06-15T01:53:23+00:00

I have a script that will update some columns on my database. It is

  • 0

I have a script that will update some columns on my database. It is written in PHP, I execute it via URL (eg. http://foo.com/xyz/yzx/dbupt8r). I did this using crontab -e then curl on the script URL, because on my mind it is like somehow similar of what I am doing: accessing it via URL. Is there any advisable or better way of doing this? Am I at security or threat flaws?

  • 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-15T01:53:25+00:00Added an answer on June 15, 2026 at 1:53 am

    There are two ways to do this, the way that you’re already doing it: (curling a publicly accessible URL); or executing the PHP script directly from your crontab.

    Cron Curling

    As you mentioned, this is often very convenient and comfortable since you’re already developing a web application in PHP and so it’s the way you’re already working. There are a few risks:

    • Most importantly, security: You’ll want to ensure that input is properly filtered, there are no risks of SQL injection, etc., in case someone discovers the URL and tries to take advantage of it. Hopefully you’re covering most of this anyway since you’re developing a web application.
    • Frequency & concurrency: You’re scheduling it’s execution from cron, so are there any issues if someone else starts calling the URL and making it fire more frequently or at the same time as a scheduled run is occurring?
    • Relying on curl: It also means you’re relying on curl to execute your script, so you’re opening yourself up to many points of failure (curl itself, DNS, etc.).

    Running PHP from Cron

    Alternatively, you may be able to run the script directly from your crontab. There are two ways of doing this:

    • Passing the PHP script to the PHP interpreter binary, which would look something like this (note the path to your PHP binary varies by platform, but should be specified as an absolute path as cron doesn’t have access to many environment variables):

      */15 * * * *    /usr/bin/php -f /path/to/php/script.php
      
    • Alternatively, you can add a hashbang/shebang line to the first line of the PHP script as follows:

      #!/usr/bin/php
      

      Make it executable, for example:

      chmod 755 /path/to/php/script.php
      

      And add it directly to your crontab:

      */15 * * * *    /path/to/php/script.php
      

    The advantages of this method are that you can put the script in a location that’s not publicly accessible so you can ensure tighter control over its access & execution. It may also mean you can write lighter code if you don’t have to handle the web side of things. That said, if you’re using a PHP framework, you may find it difficult to develop a stand-alone script such as this.

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

Sidebar

Related Questions

I have a Perl script that will execute three applications. All of it have
I have written a Python script that will generate a series of graphs and
I have a simple PHP script that will either serve up a streaming ASF
I'm trying to implement some kind of caching in a PHP script that will
I have some columns in a few tables in my database that are all
I have a PHP script that checks the last time a SQLite database has
I have a simple image upload script that uses SimpleImage.php (http://www.white-hat-web-design.co.uk/blog/resizing-images-with-php/) to resize and
I have a script that will get images from page, but how do I
I have a script that will convert a text file into a resource file,
Right now I have a script that will get the last five files in

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.