apt-get update apt-get upgrade
apt-get install libxml2 libxml2-dev apt-get install make
apt-get install mysql-server nginx
wget http://cn2.php.net/distributions/php-7.0.3.tar.bz2 tar jxf php-7.0.3 cd php-7.0.3 sudo ./configure --prefix=/usr/local/php --enable-fpm sudo make sudo make install
cp php.ini-development /usr/local/php/php.ini cp /usr/local/etc/php-fpm.conf.default /usr/local/etc/php-fpm.conf cp sapi/fpm/php-fpm /usr/local/bin
cp /usr/local/php7/etc/php-fpm.d/www.conf.default /usr/local/php7/etc/php-fpm.d/www.conf
vim /usr/local/php/php.ini cgi.fix_pathinfo=0 vim /usr/local/etc/php-fpm.conf ; Unix user/group of processes ; Note: The user is mandatory. If the group is not set, the default user‘s group ; will be used. user = www-data group = www-data /usr/local/bin/php-fpm
vim /usr/local/nginx/conf/nginx.conf location / { root html; index index.php index.html index.htm; } location ~* \.php$ { fastcgi_index index.php; fastcgi_pass 127.0.0.1:9000; include fastcgi_params; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_param SCRIPT_NAME $fastcgi_script_name; }
sudo /usr/local/nginx/sbin/nginx -s stop sudo /usr/local/nginx/sbin/nginx
rm /usr/local/nginx/html/index.html echo "<?php phpinfo(); ?>" >> /usr/local/nginx/html/index.php
打开浏览器,访问 http://localhost,将会显示 phpinfo() 。
时间: 2024-10-14 17:07:26