PHP calls to the Python module
How do I invoke external programs in PHP?
Here are the steps to proceed:
Environment: Windows XP, php5.3, python2.6.6
1. Install Python (http://www.python.org/ftp/python/2.6.6/python-2.6.6.msi)
2. Add the Python.exe directory to the system variable
Mine is F:\Python26.
If the configuration succeeds, typing python into the DOS mode will enter the Python command-line mode:
3.php Installation (PHP installation will not elaborate, will not please Baidu);
4. Write a test Python script file name: php_get_python.py
5. Using PHP to invoke the Python module, php_get_python.php
System (' php_get_python.py ');
Or
EXEC (' php_get_python.py ');
1. The Python module in this article is relatively simple, we can divergent thinking, Python can be used to do spider crawler, calculate ... and other operations.
2. Understand and master the system variables, you will have an unexpected harvest.
If E:\wamp\www\python_module\ is added to the system variable