2

I am trying to execute python script from PHP.

<?php
$asd = "Mashwani";
$command = "test.py  $asd";
$output = passthru($command);
?>

In python:

import sys
print(sys.argv)

This shows me just first argument i.e ['C:\xampp\htdocs\test.py'] but sencond atgument isn't shown. I also tried exec(), shell_exec() instead of passthru()

Muneeb
  • 99
  • 8
  • they are a response here :) [Running a Python Script From PHP (Stackoverflow)](https://stackoverflow.com/questions/19735250/running-a-python-script-from-php) – Maxence Guyonvarho Jun 06 '18 at 07:43
  • yeah trick is to use absolute path and escapeshellcmd. only difference here is Muneeb is using windows server I think. – Devidas Jun 06 '18 at 07:45
  • Thanks for the guidance. i was missing path to python. – Muneeb Jun 06 '18 at 08:23

0 Answers0