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