'PHP not executing Python script

PHP is not executing my Python script and I don't understand why. The files are both in the same folder.

PHP

<?php
  $extracted = shell_exec("python script.py");
  $message = $extracted;
  echo $message;
?>

Python

print "Hello, World!"

This is the error it gives me

Parse error: syntax error, unexpected '$message' (T_VARIABLE) in C:\Apache24\htdocs\server\test.php on line 3

It gives me a parse error, but I don’t see anything wrong with the code. It is not missing any semicolons.

I am on Windows 10.

php


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source