#安装apache2.0
sudo apt-get install apache2
#重启命令:sudo /etc/init.d/apache2 restart
#安装php
1.sudo apt-get install php7.0 libapache2-mod-php7.0
#2.重启apache:
sudo /etc/init.d/apache2 restart
#3.在网站更目录创建info.php文件:
sudo vim /var/www/html/info.php
#4.访问测试
#列出PHP支持的所有模块
sudo apt-cache search php7.0
#安装所有:
sudo apt-get install php7.0-mysql php7.0-curl php7.0-gd php7.0-intl php-pear php-imagick php7.0-imap php7.0-mcrypt php-memcache php7.0-pspell php7.0-recode php7.0-sqlite3 php7.0-tidy php7.0-xmlrpc php7.0-xsl php7.0-mbstring php-gettext php7.0-zip php-ssh2
#重启apache:
sudo /etc/init.d/apache2 restart
#安装php缓存:php-apcu(不是必须)
#1.安装:
sudo apt-get install php-apcu
#2.重启apache:
sudo /etc/init.d/apache2 restart
#配置Apache允许.htaccess和重写
#1.编辑Apache配置文件:
sudo vim /etc/apache2/apache2.conf
#2.添加一个文档根目录配置;把Directory块中的AllowOverride的值设置为All
<Directory /var/www/html/>
AllowOverride All
</Directory>
#3.启动Rewrite模块
sudo a2enmod rewrite
#4.检测我们添加的配置有没有语法错误
sudo apache2ctl configtest
#5.重启Apache
sudo /etc/init.d/apache2 restart
记录php安装
最新推荐文章于 2023-03-15 23:15:30 发布