Run PHP code with cmd

Source: Internet
Author: User

To run the PHP code with CMD, first configure the computer:

1. Right-click Computer-Properties-Advanced system settings-environment variables, we need to add environment variables.

2. Under administrator user variable (U) Click New, Pop-up dialog box, variable name (N) write: php_home, variable Value (V) for your PHP program installation path, for example my is: D:\wamp\bin\php\php5.5.12\ Php.exe, click OK after writing.

3. Locate path under System variable (S), click Edit, copy the variable value CTRL + C to the text document, then add the semicolon (if there is a semicolon), add the Php.exe folder path, and finally add a semicolon.

Then select Copy to paste into the variable value (V) and click OK.

4. Restart your computer after adding environment variables.

5. Open cmd, for example we want to run the WWW directory under 22.php this file:

After c:users\administrator> input PHP, space, and then enter d:\wamp\www\22.php, you can run this PHP file on the Web page;

Or C:users\administrator>php-f d:\wamp\www\22.php This is also possible.

You can also enter php-v (note there are spaces in the middle) to view PHP version information.

Open a 22.php file:

C:users\administrator> D:

D\>CD Wamp

D:\WAMP>CD www

d:\wamp\www>22.php

This can be opened in the DW software 22.php this file, not run. (Note space)

Run PHP code with cmd

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.