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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T07:17:09+00:00 2026-05-24T07:17:09+00:00

I want to execute a php doc through another php doc using the exec()

  • 0

I want to execute a php doc through another php doc using the exec() function. The code I have works on my local setup but for some reason it fails on my remote setup.

If I type the command directly in the command line php /home/user/domains/sitename/public_html/testing/doc1.php or php /home/user/domains/sitename/public_html/testing/doc2.php testing as any user, it executes fine and I see one new database entry. If I run doc1 directly from the browser it fails.

Folders are permission 755 and php docs are 644.

Anyone have any ideas?

Doc 1

exec('php /home/user/domains/sitename/public_html/testing/exec_test.php testing');

Doc 2 in above directory

include("/home/user/domains/sitename/public_html/connection_dir/connection.php");
$db = new PDOConnectionFactory();
$conn = $db->getConnection();

//prepare for utf8 characters
$sql = 'SET NAMES utf8';
$stmt = $conn->prepare($sql);
$result=$stmt->execute();

$sql = 'SET CHARACTER SET utf8';
$stmt = $conn->prepare($sql);
$result=$stmt->execute();
//**************************

$test=$argv[1];

 $sql = 'INSERT INTO video
(field1, field2, field3, field4, field5, field6) VALUES(?,?,?,?,?,?)';
$stmt3 = $conn->prepare($sql);
$result=$stmt3->execute(array('','',$test,'','untitled','1'));
  • 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-05-24T07:17:10+00:00Added an answer on May 24, 2026 at 7:17 am

    The php executable is probably not in $PATH. Specify the full path to your php interpreter, i.e. /usr/bin/php.

    Also if you don’t have a good reason to use exec, just include the file.

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

Sidebar

Related Questions

I want to execute multiple shell-commands with php's exec command. The commands have to
I want to execute cmd commands using PHP, but I don';t want to execute
In PHP, I want to execute a function when a hyperlink is clicked. The
I want to execute a .exe file on my Apache server using a php
I'm using TinyMCE and want to execute a php script get the output and
My $.ajax success function never triggers. I just want to execute a PHP file
I have a PHP file I want to execute at the beginning of each
So I create text(php) editor and I want to execute PHP code without refreshing
I want to execute a PHP function in every 5mins. A basic timer should
I have a piece of javascript code that I want to execute on 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.