Does anyone know if running APT commands in PHP is possible, and if so, how? Thanks in advance.
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
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.
Assuming you mean Debian’s Advanced Packaging Tool, you can run apt commands using a variety of functions:
exec()passthru()shell_exec()system()proc_open()you can find the documentation for all of them here: http://php.net/manual/en/ref.exec.php
exec()is probably the one you want, since it lets you capture the return value and the output.you could also use backticks: http://www.php.net/manual/en/language.operators.execution.php