PHPer 在Linux 下开发的常用命令

常用应用命令

centos7 每个上下依次是启动,停止,重启 后面紧接着是ubuntu

apache

systemctl start httpd               service apache2 start
systemctl stop httpd                service apache2 stop
systemctl restart httpd             service apache2 restart

mysql

systemctl start mysqld              service mysql start
systemctl stop mysqld               service mysql start
systemctl restart mysqld            service mysql start

php-fpm

systemctl start php-fpm          service start php-fpm
systemctl stop php-fpm             service stop php-fpm
systemctl restart php-fpm         service restart php-fpm

nginx

systemctl start nginx            service nginx start
systemctl stop nginx             service nginx stop
systemctl restart nginx          service nginx restart

vim /etc/sysconfig/iptables 后生效命令

systemctl start iptables        service iptables restart

cnentos和untuntu 都是非常常见的linux 系统 前者安全后者更易用

如果你安装的应用是多版本的 你的启动命令可以加上版本号,若权限不过可加 sudo

sudo service start php7.2-fpm

如果遇到上述命令不能使用可以使用路径命令进行执行如:

/etc/init.d/mysql start/stop/restart/reload

/usr/sbin/nginx -s start/stop/restart/reload

补充:

PHP 目录
php --ini                          确定php.ini文件的位置
vi /etc/php.ini                    修改php.ini文件
vi /etc/php-fpm/www.conf           修改php-fpm.conf文件
Nginx/Apache

配置文件在 /etc/nginx/xxx.conf 错误日志通常在 xxx.conf 文件中 error_log行可以找到

error_log      logs/error_www.pcity.top.log    error;

HTML

Copy

如果不知道软件安装的位置该如何查如果不知道软件安装的位置该如何查找
  1. whereis mysql 会查找出mysql安装的路径

  2. which mysql 会查找出mysql运行所在路径

  3. find / -name mysql 在根目录下查找mysql

  4. locate msyql 会列出更全的mysql路径

locate好用但需要安装:

ubuntu中:

apt-get update

apt-get install mlocate

centos中:

yum install mlocate

locate是一种比find更快的方式,因为它在数据库中查找文件。要更新搜索数据库,运行下面的命令:

updatedb

使用locate查找文件的语法:

locate test.file

就像find命令一样,locate也有很多选项来过滤输出。要了解更多你可以查看Linux Locate命令的手册。

man locate

个人博客停止维护,部分博客转载到这

  • 彼特城
  • 2020-08-10 11:41:40
本作品采用《CC 协议》,转载必须注明作者和本文链接
滴水穿石,石破天惊----晓疯子
zhaocrazy
讨论数量: 0
(= ̄ω ̄=)··· 暂无内容!

讨论应以学习和精进为目的。请勿发布不友善或者负能量的内容,与人为善,比聪明更重要!