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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T23:10:43+00:00 2026-06-03T23:10:43+00:00

How can PHP be used to create a number of commands in the terminal?

  • 0

How can PHP be used to create a number of commands in the terminal? For example, if I want to change the permissions on a folder or a file, I might run

Sudo Chmod 777 FileName

from the command line. How could I do this with PHP?

  • 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-03T23:10:45+00:00Added an answer on June 3, 2026 at 11:10 pm

    Look at exec, system etc: http://www.php.net/manual/en/book.exec.php

    Obviously, if you are going to use sudo for root access stuff (not recommended) then you would need to either supply a password somehow or set the user which PHP is running as to not require a password.

    It may be better to use an SSH call for this and supply the command to execute via that command.

    To sum up, I really don’t recommend using PHP (or any language for that matter) to run a series of commands which then uses sudo

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

Sidebar

Related Questions

Is there any IDE (linux based) for PHP that can be used to debug?
What is an abstract class in PHP? How can it be used?
how to make php can read log file in /var/log/.... I tried this code
How can i create a collage from a large number of images as per
Using PHP and/or Codeigniter, I want to create some string templates to be store
I'm new to PHP (used to Python) and I've been instructed to create something
Coming from PHP world, I used to create select box like this: <select> <?php
Can PHP array passed POST method to catch in ASP.NET MVC? Query string: WebAccess/ArrayTest?val[]=1&val[]=2&val[]=3
How can PHP cause memory leaks, buffer overflows, stack overflows and any other errors
my question is pretty simple: can PHP and Java communicate, while PHP being 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.