安装php7.0
apt-get install php7.0
apt-get install php7.0-mbstring
apt-get install php7.0-xml
apt-get install php7.0-cli php7.0-common php7.0-curl php7.0-gd php7.0-mysql libxml2 libxml2-dev build-essential openssl libssl-dev libcurl4-gnutls-dev libjpeg-dev libpng-dev libmcrypt-dev libreadline6 libreadline6-dev libgd-dev libxslt-dev
//否则composer install 报错
ubuntu14.04安装 php7.0
首先查看下当前源中是否含有php7.0
sudo apt-cache search php7.0
如果没有,则添加源,并更新,然后安装
sudo apt-get install software-properties-common
sudo add-apt-repository ppa:ondrej/phpsudo
apt-get update
如果有则直接安装
sudo apt-get install php7.0
整合php和Apache
sudo apt-get install libapache2-mod-php7.0
sudo service apache2 restart
laravel安装mongodb扩展
首先安装上面方法添加php最新的扩展源
依次执行
apt-get install mongodb
apt-get install php7.0-mongodb
`#如果apt-get install php7.0-mongodb 报错
执行apt-get install php-mongodb
重启服务器
其他2种方法参考:http://www.jianshu.com/p/c628bfa4b243
nginx配置php7.0
#修改
vim /etc/nginx/sites-available/default
#将相关配置改为以下
server {
listen 80 default_server;
listen [::]:80 default_server;
# SSL configuration
#
# listen 443 ssl default_server;
# listen [::]:443 ssl default_server;
#
# Note: You should disable gzip for SSL traffic.
# See: https://bugs.debian.org/773332
#
# Read up on ssl_ciphers to ensure a secure configuration.
# See: https://bugs.debian.org/765782
#
# Self signed certs generated by the ssl-cert package
# Don't use them in a production server!
#
# include snippets/snakeoil.conf;
root /var/www/html;
# Add index.php to the list if you are using PHP
index index.php index.html index.htm index.nginx-debian.html;
server_name _;
location / {
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
try_files $uri $uri/ /index.php?$query_string; //伪静态
#try_files $uri $uri/ =404;
}
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
location ~ \.php$ {
include snippets/fastcgi-php.conf;
# With php7.0-cgi alone:
# fastcgi_pass 127.0.0.1:9000;
# With php7.0-fpm:
fastcgi_pass unix:/run/php/php7.0-fpm.sock;
}
# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
location ~ /\.ht {
deny all;
}
}
vi /etc/php/7.0/fpm/php.ini
#将 cgi.fix_pathinfo=1 这一行去掉注释,将1改为0
//重启nginx
/etc/init.d/nginx restart
网友评论