I used python -m SimpleHTTPServer, but the PHP files don't execute instead they just been downloaded.
I heard about WPHP in an old post. But I don't know how to use it. How I can work with it ?
The reason why the Python Webserver sends your PHP files to the brower is likely because it is not configured or able to handle PHP files. See https://serverfault.com/questions/338394/how-to-run-php-with-simplehttpserver
PHP 5.4 has a built-in webserver. You can call it from the command line like this:
php [options] -S <addr>:<port> [-t docroot]
Example
C:\Users\Gordon>php -S 127.0.0.1:80 -t .
PHP 5.4.0 Development Server started at Sun Sep 02 14:20:28 2012
Listening on 127.0.0.1:80
Document root is C:\Users\Gordon
Press Ctrl-C to quit.
Note that if you omit -t PHP will use the current working directory.
cd to the folder and run php -S 127.0.0.1:8000. The webpage index.html in that folder (using the w3school code) is blank when http://localhost:8000/ or http://127.0.0.1:8000/ are opened in browsers. A console.log message does come through in the browser however.. at the end. However, even then your file will not get parsed when its called index.html. It has to be index.php.index.php and you cd to the folder you can simply usephp -S localhost:9000 this will avoid also permissions errors.It appears that as of early 2024 the "production" answer to this question remains "no" unless you want to do some Python work of your own.
The servault.com link provided in 2012, ironically, has a 2014 post (by "TheGuyWithTheFace") referring back to this thread for the "answer," which is to use the webserver built into PHP starting in 5.4.4.
But php.net pretty clearly states that their webserver is intended for development only, not for any production environment. If you're wanting something in a development environment, the PHP server is likely to be enough for you.