• 每天进步一点点!

文章分类

推荐网站

常用手册

ubuntu安装lanmp环境【原创】

<<返回

2013-08-10 22:22:51

ubuntu14.04安装php5

  • 只安装lamp
debconf-set-selections <<< 'mysql-server-5.5 mysql-server/root_password password root' && debconf-set-selections <<< 'mysql-server-5.5 mysql-server/root_password_again password root' && apt-get install mysql-server mysql-client  apache2 php5 php5-cli php5-common php-pear php5-curl php5-dbg php5-dev php5-gd php5-ldap  php-auth php5-mysql php5-sqlite php5-xmlrpc php5-xsl php5-tidy php5-imagick  php5-imap php5-memcache php5-mcrypt php5-radius php5-xcache php5-xdebug phpunit php5-geoip php5-intl libapache2-mod-php5
  • 只安装lnmp
debconf-set-selections <<< 'mysql-server-5.5 mysql-server/root_password password root' && debconf-set-selections <<< 'mysql-server-5.5 mysql-server/root_password_again password root' && apt-get install mysql-server mysql-client nginx  php5 php5-cli php5-common php-pear php5-curl php5-dbg php5-dev php5-gd php5-ldap  php-auth php5-mysql php5-sqlite php5-xmlrpc php5-xsl php5-tidy php5-fpm php5-imagick  php5-imap php5-memcache  php5-mcrypt php5-radius php5-xcache php5-xdebug phpunit php5-geoip php5-intl
  • 安装lanmp
debconf-set-selections <<< 'mysql-server-5.5 mysql-server/root_password password root' && debconf-set-selections <<< 'mysql-server-5.5 mysql-server/root_password_again password root' && apt-get install mysql-server mysql-client nginx apache2 php5 php5-cli php5-common php-pear php5-curl php5-dbg php5-dev php5-gd php5-ldap  php-auth php5-mysql php5-sqlite php5-xmlrpc php5-xsl php5-tidy php5-imagick  php5-imap php5-memcache php5-mcrypt php5-radius php5-xcache php5-xdebug phpunit php5-geoip php5-intl  libapache2-mod-php5 php5-fpm 

 

ubuntu16.04安装php7

  • 只安装lamp
sudo apt-get install -y php-pear php7.0 php7.0-dev php7.0-cli php7.0-common php7.0-bcmath php7.0-bz2 php7.0-curl php7.0-dba php7.0-gd php7.0-json php7.0-mcrypt php7.0-mbstring php7.0-mysql php7.0-pdo php7.0-readline php7.0-simplexml php7.0-xml php7.0-zip php7.0-opcache php7.0-soap apache2 libapache2-mod-php7.0  mysql-client mysql-server 

 

ubuntu20.04 安装php7.4

sudo apt-get install -y php-pear php7.4 php7.4-dev php7.4-cli php7.4-common php7.4-bcmath php7.4-bz2 php7.4-curl php7.4-dba php7.4-gd php7.4-json  php7.4-mbstring php7.4-mysql php7.4-common php7.4-readline php7.4-xml php7.4-xml php7.4-zip php7.4-fpm
  • 一些问题

(一)apache遇到的问题

  1. 在Ubuntu上安装Apache,每次重启,都会出现以下错误提示:

Could not reliably determine the server’s fully qualified domain name, using 127.0.1.1 for ServerName

解决办法:

修改 000-default.conf 文件

打开终端,输入以下命令:

sudo vim /etc/apache2/sites-available/000-default.conf

在文件第一行中加入以下内容:

ServerName localhost

保存文件退出,再次重启apache,错误提示没有了。

 

  1. 启用apache的rewrite模块
sudo a2enmod rewrite

重启apache

  1. 重启apache用下面的命令:否则会报错:Invalid Mutex directory in argument file:${APACHE_LOCK_DIR}
sudo /etc/init.d/apache2 restart

 

(二)nginx遇到的问题

  1. nginx配置

 修改 /etc/nginx/sites-available/default 将下面的部分注释去掉

 

location ~ .php$ {
fastcgi_split_path_info ^(.+.php)(/.+)$;
# # NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini
#
# # With php5-cgi alone:
fastcgi_pass 127.0.0.1:9000;
# With php5-fpm:
# fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
include fastcgi_params;
}

(三) PHP遇到的问题

开启某个扩展 如:

#php5
sudo php5enmod mcrypt

#php7
sudo phpenmod mcrypt

 

 

文章评论

  • 暂无评论

发表评论

昵称:

内容:

发表评论