PHP的環境搭建(非整合)

來源:互聯網
上載者:User

標籤:php   apache   mysql   

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 .phpPHPIniDir "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鏡像:

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

     全域有效:   

composer 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

     


本文出自 “念倏之” 部落格,請務必保留此出處http://nianshuzhi.blog.51cto.com/12664940/1904242

PHP的環境搭建(非整合)

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.