PHP and MySQL command line beginner tutorial

Source: Internet
Author: User
Tags php and mysql

PHP developer beginners tend to ignore the role of the command line, indeed, in the database management tools and integrated development environment, command-line operations are becoming increasingly neglected. However, when developing large projects or running large files and large data files, it might be more appropriate to have command-line operations.

Set PHP path

There are two ways to run PHP on the command line:

1. Setting Environment variables

For this method, you need to set the PHP path first, such as "c:\wamp\bin\php\php5.x.x1", as the environment variable. Once set, you need to check the command line for success. Enter Php-v, if you can return PHP version information, stating that the settings are successful, otherwise you will restart the system and reconfigure as described above.

2. Do not use environment variables

Sometimes you just want to execute your script file instead of setting environment variables, you can do this: (1) Open the command line. (2) Go to your PHP path, such as C:\wamp\bin\php\. (3) Enter Php-v. If your path is correct, then you can still see the PHP version information:

Execute PHP script

You need to enter this command to execute: PHP script.php, but sometimes error: "File not found on Location/not included", which means you add a relative path, should be changed to an absolute path.

command-line control of MySQL

You need to follow these steps:

(1) Run the command line (2) into the MySQL path, then enter Mysql-u user-p (3) Select the database Use Test (4) Check that it is the latest version mysql\r OK, now that you are connected to test db, then you can execute the SQL statement.

For more new experiences, download smart development tools (currently phpstorm year-end promotions). There are also 50 percent time-limited snapping and free collar iphone?6, Ipad?air and other good gifts!


PHP and MySQL command line beginner tutorial

Related Article

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.