Python script in php code

At first we create a php file and we name it: test.php.


$python = exec(`python`);
echo $python;


As we see, there is a variable called: $python. This variable keeps the output of file. :

print  "If you can read this inside a Web-Browser window, you can successfully run Python through XAMPP!'"

Now is time check if test.php is going to browse python's file message.

We save both files in a sub-directory of htdocs of xampp (let's call this sub-directory 'my_projects')

Now we type at url http://localhost/my_projects/hello.php.

We have to see in our browser the python's file message,as it looks below.


Popular posts from this blog

Vertex Cover (python implementation)

Transportation Problem (Vogel algorithm python)

IP scanning in python