How PHP calls the Python module

Source: Internet
Author: User
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

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.