PHP环境

PHP环境


Centos安装PHP

<p>以Centos6.6、通过yum安装为例子。需要编译安装的请暂先搜索网络教程,这里尚未来得及整理。</p> <p>首先你需要安装web服务器,apache或者nginx中的一个(如果已安装了请忽略),然后再安装PHP环境配合使用</p> <h3>安装 Apache + PHP</h3> <p><code>yum install httpd</code></p> <p><code>yum install php php-gd php-mcrypt php-mbstring php-mysql php-pdo php-zip</code></p> <p><code>service httpd start</code></p> <p><code>chkconfig httpd on</code> </p> <p>安装完毕后,默认的Apache Web目录是<code>/var/www/html</code>,将ShowDoc上传并按照部署手册安装即可</p> <h3>安装Nginx + PHP</h3> <p><code>yum install nginx</code></p> <p><code>yum install php php-gd php-fpm php-mcrypt php-mbstring php-mysql php-pdo php-zip</code></p> <p>安装完后,在<code>/etc/nginx/conf.d</code>新建文件<code>127.0.0.1.conf</code></p> <pre><code> 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; } }</code></pre> <p>保存。然后执行命令:</p> <p><code>service nginx start</code></p> <p><code>service php-fpm start</code></p> <p><code>chkconfig php-fpm on</code></p> <p><code>chkconfig nginx on</code></p> <p>然后进入目录<code>/var/www/html</code>(不存在则新建),将ShowDoc上传并按照部署手册( <a href="https://www.showdoc.com.cn/help?page_id=13732">https://www.showdoc.com.cn/help?page_id=13732</a> )安装即可。安装后便可通过浏览器访问127.0.0.1</p>

页面列表

ITEM_HTML