霜天部落 | 专注PHP研发,研究LAMP高性能架构部署与优化

ubuntu开机自动启动XAMPP

ubuntu下安装XAMPP后,如果想开机自动启动XAMPP的话,可以有两种方式实现:

第一种方法:

1. 以 root 的身份登入
2. 在 /etc/init.d 目录下建立 lampp.sh

lampp.sh 內容如下:

#!/bin/shcd /opt/lampp./lampp start

3. 更改权限

chmod 755 lampp.sh

4. 編輯 /etc/init.d/rc.local 在最后一行加上:

exec /etc/init.d/lampp.sh

重新开机就完成了。

註:这种方法就算开机后沒有登入,XAMPP 还是会启动。

第二种方法:

  1. First, find out your default runlevel.
    Simply type egrep :initdefault: /etc/inittab.
    You should now see a line containing a number between two colons.
    In most cases 3 or 5 (2 if you’re using Debian).
  2. Go into the directory which configures this runlevel. If for example your runlevel is 3, then you have to change into the /etc/rc.d/rc3.d directory:cd /etc/rc.d/rc3.dIf your system didn’t provide /etc/rc.d/rc3.d please try also /etc/init.d/rc3.d and /etc/rc3.d.
  3. Now carry out the actual configuration by typing:ln -s /opt/lampp/lampp S99lampp
    ln -s /opt/lampp/lampp K01lampp