栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 软件开发 > 后端开发 > PHP

PHP的环境搭建(非集成)

PHP 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

PHP的环境搭建(非集成)

Apache

     1. 下载地址:

         http://httpd.apache.org/

     2. 配置更改【所有 '' 换成 '/'】:

          打开httpd.conf文件,更改apache的安装路径;

          更改项目文件路径;

          开启rewrite扩展;

     3. 添加与PHP的连接:       

LoadModule php5_module "C:/Wamp/php56/php5apache2_4.dll"            

AddHandler application/x-httpd-php .php

PHPIniDir "C:/Wamp/php56"

     4. 安装命令:

          cd到apache根目录,执行httpd.exe -k install -n "服务名"

     5. 卸载命令:

          停止apache服务,执行httpd.exe -k uninstall -n "服务名"


PHP

     1. 下载地址:

     http://php.net/downloads.php

     2. 配置更改:

     打开php.ini文件,在php扩展前添加:extension_dir = ext;

     按照需要打开php的扩展;

     3. 环境变量:

     计算机 > 属性 > 环境变量 > Path > php路径


MySQL

     1. 下载地址:

     https://dev.mysql.com/downloads/mysql/

     2. 配置更改:

     暂无

     3. 环境变量:

     计算机 > 属性 > 环境变量 > Path > MySQL路径


Memcache

     1. 下载地址:

     http://memcached.org/

     2. 配置更改:

     将php_memcache扩展复制到PHP的ext文件夹中

     在php.ini中添加php_memcache扩展

     3. 安装命令:

     cd到memcache的本目录,执行memcache.exe -d install

     4. 卸载命令:

     停止memcache服务,执行memcache.exe -d uninstall


Composer

     1. 下载地址:

     https://getcomposer.org/download/

     2. 配置更改:

     需要开启openssl扩展、PHP环境变量

     将composer.phar文件放到PHP根目录中;

     并先建一个bat文件:@php "%~dp0composer.phar" %*;

     执行composer --version查看当前版本;

     升级composer selfupdate;

     3. 修改当前项目使用国内composer镜像:

1composer config repo.packagist composer  https://packagist.phpcomposer.com

     全局有效:   

1composer config  -g repo.packagist composer https://packagist.phpcomposer.com


Nginx

     1. Web运行机制:

          用户 > 浏览器 > 域名 > DNS > IP > Nginx > php-fpm > xxx.php > html > 浏览器显示出来


     2. Nginx配置文件

          /usr/local/nginx/conf/nginx.conf

          用户:root

          目录:/home/wwwroot/;


     3. Php-fpm 配置文件

          /usr/local/php/etc/php-fpm.conf

          user = www

          所以要对www用户授权

          chmod -R 777 /home/wwwroot

          setfacl -R -m u:www:rwx runtime

          setfacl -R -m d:u:www:rwx runtime

 

     3. Nginx配置

# ...

     server{

          # ...

          root /home/wwwroot/project/web/;

          location / {

               index index.html index.php;

               try_files $uri @rewrite;

          }

          location @rewrite {

               rewrite ^/(.*)$ /index.php/$1 last;

          }

          location ~ .php(/|$) {

               fastcgi_pass 127.0.0.1:9000;

               fastcgi_split_path_info ^(.+.php)(.*)$;

               fastcgi_param PATH_INFO $fastcgi_path_info;

               fastcgi_param script_FILENAME $document_root$fastcgi_script_name;

               include fastcgi_params;

          }

     }


     4. Nginx重新加载配置文件:

          /usr/local/nginx/sbin/nginx -s reload

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/229377.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号