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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T05:38:58+00:00 2026-06-05T05:38:58+00:00

While running one PHP script. The script will call another one somewhere in the

  • 0

While running one PHP script. The script will call another one somewhere in the script. Those two scripts will need to run simultaneous so I can not use include or require here. The script will be called using the terminal like this:

exec( '/usr/bin/php ../process.php >> logs/' . date( 'Y_m_d' ) . '.log 2>&1 &' );

The big problem here is I want to process 6 different things, but they will all be using quite the same code. The only difference is the directory where they will be processed in.

Now the question: Is there a simple way to run the second script while passing one or more variables?

I tried something like ../process?var=something, but this clearly doesn’t work this way.

  • 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-05T05:38:59+00:00Added an answer on June 5, 2026 at 5:38 am

    You can pass some variables as arguments to the script. All the arguments passed are in the variable $argv.

    See php docs $argv

    Then just loop through the $argv and maybe check for some keywords you define.

    exec( '/usr/bin/php ../process.php -f '/path/to/folder' >> logs/' . date( 'Y_m_d' ) . '.log 2>&1 &' );
    

    The $argv variable would then hold -f and /path/to/folder, so just check for -f in the loop and get the value by position of -f+1.

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

Sidebar

Related Questions

I keep on getting this error when running one of my scripts; PHP Fatal
In php what is the best way to run a script after one has
If while an application is running one of the shared libraries it uses is
i have developed application while running my application another application ContactManager is also get
I have a php script that comes down to the following: while ($arr =
I have php scripts that I have to run on linux as well as
I am running this script it is fine for one context but when I
I was testing out whether unset() affects memory while the script is running, to
I am running 10 PHP scripts at the same time and it processing at
I'm getting the following error while running Snappy, a PHP binding for WKHTMLTOPDF: Fatal

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.