debian mint lamp环境搭建 php7

首先是a:

sudo apt-get install apache2

现在localhost应该没问题了

接下来安装php:

sudo apt-get -y install php7.2-fpm php7.2-mysql php7.2-curl php7.2-json php7.2-mbstring php7.2-xml  php7.2-intl

一些扩展,选择安装:
  sudo apt-get install php7.2-gd
  sudo apt-get install php7.2-soap
  sudo apt-get install php7.2-gmp 
  sudo apt-get install php7.2-odbc
  sudo apt-get install php7.2-pspell     
  sudo apt-get install php7.2-bcmath  
  sudo apt-get install php7.2-enchant   
  sudo apt-get install php7.2-imap
  sudo apt-get install php7.2-ldap
  sudo apt-get install php7.2-opcache
  sudo apt-get install php7.2-readline   
  sudo apt-get install php7.2-sqlite3    
  sudo apt-get install php7.2-xmlrpc
  sudo apt-get install php7.2-bz2
  sudo apt-get install php7.2-interbase
  sudo apt-get install php7.2-pgsql  
  sudo apt-get install php7.2-recode 
  sudo apt-get install php7.2-sybase
  sudo apt-get install php7.2-xsl
  sudo apt-get install php7.2-cgi    
  sudo apt-get install php7.2-dba
  sudo apt-get install php7.2-phpdbg   
  sudo apt-get install php7.2-snmp 
  sudo apt-get install php7.2-tidy
  sudo apt-get install php7.2-zip
  sudo apt-get install php7.2-odb

接下来在/var/www/html/目录下创建test.php:

<?php
phpinfo();

访问localhost/test.php

不出意外的话,应该不会解析

必须安装php对于apache的模块:

sudo apt install php libapache2-mod-php

重启服务器

应该ok了

对于m:

https://blog.csdn.net/hongxiao2016/article/details/89394926

deepin也是debian系的,对mint也适用

接下来在/var/www/html/目录下创建test1.php:

<?php
$servername = "localhost";
$username = "用户名";
$password = "密码";
 
// 创建连接
$conn = new mysqli($servername, $username, $password);
 
// 检测连接
if ($conn->connect_error) {
    die("连接失败: " . $conn->connect_error);
} 
echo "连接成功";
?>

然后localhost/test1.php

如果成功就ok了

else

接下来看完在弄

我的到这儿访问没有任何反应:

  sudo apt-get install php-mysql

其实上面已经安装了mysql扩展,我觉得可能有问题又安装了一次

然而还是失败了,我气愤的关闭了电脑,出去冷静了一下,

我再次出现在电脑面前时一开机,问题解决了。。。

所以遇到问题要冷静

分析后,极其可能的原因是:安装apache后安装的mysql扩展,未重启服务器,未生效。。。

后来又安装了一个phpmyadmin,

sudo apt-get install phpmyadmin php-mbstring php-gettext
sudo ln -s /usr/share/phpmyadmin /var/www/html/phpmyadmin
sudo /etc/init.d/apache2 restart

最后localhost/test2.php也成功了

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值