Centos安装PHP
以Centos6.6、通过yum安装为例子。需要编译安装的请暂先搜索网络教程,这里尚未来得及整理。
首先你需要安装web服务器,apache或者nginx中的一个(如果已安装了请忽略),然后再安装PHP环境配合使用
安装 Apache + PHP
yum install httpd
yum install php php-gd php-mcrypt php-mbstring php-mysql php-pdo php-zip
service httpd start
chkconfig httpd on
安装完毕后,默认的Apache Web目录是/var/www/html
,将ShowDoc上传并按照部署手册安装即可
安装Nginx + PHP
yum install nginx
yum install php php-gd php-fpm php-mcrypt php-mbstring php-mysql php-pdo php-zip
安装完后,在/etc/nginx/conf.d
新建文件127.0.0.1.conf
server {
listen 80;
server_name 127.0.0.1;
root /var/www/html;
index index.php index.html;
error_page 404 /404.html;
location = /40x.html {
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
}
location ~ \.php$ {
root /var/www/html;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
location ~ /\.ht {
deny all;
}
}
保存。然后执行命令:
service nginx start
service php-fpm start
chkconfig php-fpm on
chkconfig nginx on
然后进入目录/var/www/html
(不存在则新建),将ShowDoc上传并按照部署手册( https://www.showdoc.com.cn/help?page_id=13732 )安装即可。安装后便可通过浏览器访问127.0.0.1