PHP经验分享

Mac上XAMPP命令行操作

2018-05-07  本文已影响13人  developerAbble

笔者MacOS上安装的是XAMPP。当初选择XAMPP,无非是图方便,还有就是前辈的影响。

但图形界面操作,一方面不够专业,不够快;另一方面,阻碍了对知识的理解。于是,痛定思痛,改变习惯。

现在的认知来自于下面这篇文章。自认为这篇文章写得非常优秀。
XAMPP(Mac OS X 版)官网下载

下面笔者捡几点,并加上实际操作记录一下:

找到XAMPP,观察XAMPP下的目录

 /Applications/XAMPP  l
total 16
drwxrwxr-x  12 root  admin   384B  5  7 21:26 .
drwxrwxr-x+ 70 root  admin   2.2K  5  6 02:04 ..
-rw-r--r--@  1 abao  admin   6.0K  5  7 20:53 .DS_Store
drwxr-xr-x   6 abao  admin   192B  1  1 15:04 .idea
lrwxr-xr-x   1 root  admin    14B 12  9 16:41 bin -> xamppfiles/bin
lrwxr-xr-x   1 root  admin    18B 12  9 16:41 cgi-bin -> xamppfiles/cgi-bin
lrwxr-xr-x   1 root  admin    14B 12  9 16:41 etc -> xamppfiles/etc
lrwxr-xr-x   1 root  admin    17B 12  9 16:41 htdocs -> xamppfiles/htdocs
lrwxr-xr-x   1 root  admin    15B 12  9 16:41 logs -> xamppfiles/logs
lrwxr-xr-x   1 root  admin    26B 12  9 16:41 manager-osx.app -> xamppfiles/manager-osx.app
drwxr-xr-x   3 root  admin    96B 12  9 16:41 uninstall.app
drwxrwxr-x  38 root  admin   1.2K  5  7 20:50 xamppfiles
 /Applications/XAMPP 

XAMPP下就两个目录。一个xamppfile,一个uninstall.app。从这里也看到了一个分析目录的方法:很多目录是软链接,单从命令行中看不出来。这个时候就要看目录的详细信息了。

/Applications/XAMPP/xamppfiles/bin
 /Applications/XAMPP  ./bin/mysql -uroot -p
Enter password:
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 6
Server version: 10.1.10-MariaDB Source distribution

Copyright (c) 2000, 2015, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [(none)]>
/Applications/XAMPP/xamppfiles/etc
php:php.ini
Apache: httpd.conf
mysql: my.cnf
/Applications/XAMPP/xamppfiles/manager-osx.app

这个很熟悉,open一下,便打开了笔者以前惯用的图形操作界面。

image.png
/Applications/XAMPP/xamppfiles/xampp
 /Applications/XAMPP/xamppfiles  ./xampp status
Version: XAMPP for Linux 7.0.2-1
Apache is not running.
cat: /Applications/XAMPP/xamppfiles/var/mysql/MacBook-Air.local.pid: Permission denied
MySQL is running.
ProFTPD is deactivated.
 /Applications/XAMPP/xamppfiles  ./xampp help
Usage: xampp <action>

    start         Start XAMPP (Apache, MySQL and eventually others)
    startapache   Start only Apache
    startmysql    Start only MySQL
    startftp      Start only ProFTPD

    stop          Stop XAMPP (Apache, MySQL and eventually others)
    stopapache    Stop only Apache
    stopmysql     Stop only MySQL
    stopftp       Stop only ProFTPD

    reload        Reload XAMPP (Apache, MySQL and eventually others)
    reloadapache  Reload only Apache
    reloadmysql   Reload only MySQL
    reloadftp     Reload only ProFTPD

    restart       Stop and start XAMPP
    security      Check XAMPP's security

    enablessl     Enable SSL support for Apache
    disablessl    Disable SSL support for Apache

    backup        Make backup file of your XAMPP config, log and data files

    oci8          Enable the oci8 extenssion

    fix_rights    Resets file permissions.

 /Applications/XAMPP/xamppfiles 

总而言之,记住这两个命令。操作起来方便多了。

./xampp status
./xampp help

外加一个总结

并不是笔者有意排斥图形界面。合适的地方做合适的事。用什么,依据的标准很简单:是不是更快,是不是让自己对原来事务的认知有所提升。

上一篇 下一篇

猜你喜欢

热点阅读