Install PHP Windows

[vc_row full_width=”stretch_row_content_no_spaces” options=”window_height,centered” vsc_text_scheme=”darker-overlay” vsc_parallax=”yes” css=”.vc_custom_1507675697110{padding-top: 50px !important;padding-bottom: 75px !important;}” vsc_bg_image=”4249″][vc_column 0=””][vsc-section-title align=”center” title=”Windows PHP Installation” title_color=”#ffffff” subtitle_color=”#ffffff”]Let’s go through to setup PHP on Windows[/vsc-section-title][/vc_column][/vc_row][vc_row full_width=”stretch_row_content_no_spaces” vsc_text_scheme=”darker-overlay” vsc_bg_color=”#000000″][vc_column el_class=”fullsize-wrapper” width=”1/2″ css=”.vc_custom_1427124129051{padding-right: 0px !important;padding-left: 0px !important;}”][vc_single_image image=”4318″ onclick=”img_link_large”][/vc_column][vc_column el_align=”alignleft” width=”1/2″ css=”.vc_custom_1424436615643{padding-top: 10px !important;padding-left: 75px !important;}”][vsc-section-title align=”left” title=”DOWNLOAD PHP FILES” title_color=”#ffffff”][/vsc-section-title][vc_column_text css=”.vc_custom_1507676664432{padding-right: 150px !important;}”]Head over to the PHP website and download the current version of PHP so we may proceed.

PHP Website

 

Download either x86 or x64 depending on your processor[/vc_column_text][/vc_column][/vc_row][vc_row full_width=”stretch_row_content_no_spaces” vsc_text_scheme=”darker-overlay” vsc_bg_color=”#000000″][vc_column el_align=”alignright” width=”1/2″ css=”.vc_custom_1424436739791{padding-top: 25px !important;padding-right: 75px !important;}”][vsc-section-title align=”right” title=”EXTRACT PHP” title_color=”#ffffff” subtitle_color=”#ffffff”][/vsc-section-title][vc_column_text 0=””]In this tutorial we will be using the path of C:/nginx for everything so place the contents of the folder in the php Zip in a folder named php in C:/nginx[/vc_column_text][/vc_column][vc_column el_class=”fullsize-wrapper” width=”1/2″ css=”.vc_custom_1426629203668{padding-right: 0px !important;padding-left: 0px !important;}”][vc_single_image image=”4275″ onclick=”link_image”][/vc_column][/vc_row][vc_row full_width=”stretch_row_content_no_spaces” vsc_text_scheme=”darker-overlay” vsc_bg_color=”#000000″][vc_column el_align=”alignright” width=”1/2″ css=”.vc_custom_1424436739791{padding-top: 25px !important;padding-right: 75px !important;}”][vc_single_image image=”4317″][/vc_column][vc_column el_class=”fullsize-wrapper” width=”1/2″ css=”.vc_custom_1426629203668{padding-right: 0px !important;padding-left: 0px !important;}”][vsc-text-icon align=”left” type=”fontawesome” icon_fontawesome=”fa fa-question-circle-o” icon=”fa-diamond” title=”OPTIONAL”]If you already have VC Runtime you can skip this step.[/vsc-text-icon][vsc-section-title align=”right” title=”DOWNLOAD VCS” title_color=”#ffffff” subtitle_color=”#ffffff”][/vsc-section-title][vc_column_text 0=””]PHP Builds require Visual C++ Redistributable for Visual Studio.  Depending on which install you went with will determine which VC to download.  Once downloaded, extract and install like normal.

[/vc_column_text][/vc_column][/vc_row][vc_row full_width=”stretch_row_content_no_spaces” vsc_text_scheme=”darker-overlay” vsc_bg_color=”#000000″][vc_column el_align=”alignright” width=”1/2″ css=”.vc_custom_1424436739791{padding-top: 25px !important;padding-right: 75px !important;}”][vsc-section-title align=”right” title=”COPY php.ini-production” title_color=”#ffffff” subtitle_color=”#ffffff”][/vsc-section-title][vc_column_text 0=””]Head over to the php folder located in the nginx folder.

Find php.ini-production and copy or rename it to php.ini

We will come back to this file later.

[/vc_column_text][/vc_column][vc_column el_class=”fullsize-wrapper” width=”1/2″ css=”.vc_custom_1426629203668{padding-right: 0px !important;padding-left: 0px !important;}”][vc_single_image image=”4316″][/vc_column][/vc_row][vc_row full_width=”stretch_row_content_no_spaces” vsc_text_scheme=”darker-overlay” vsc_bg_color=”#000000″][vc_column el_class=”fullsize-wrapper” width=”1/2″ css=”.vc_custom_1426629209543{padding-right: 0px !important;padding-left: 0px !important;}”][vc_single_image image=”4277″][/vc_column][vc_column el_align=”alignleft” width=”1/2″ css=”.vc_custom_1424436885710{padding-top: 50px !important;}”][vc_row_inner css=”.vc_custom_1424342268614{padding-top: 10px !important;}”][vc_column_inner][vsc-text-icon align=”left” type=”fontawesome” icon_fontawesome=”fa fa-question-circle-o” icon=”fa-diamond” title=”OPTIONAL”]If you already have NSSM installed, you may skip this step.[/vsc-text-icon][/vc_column_inner][/vc_row_inner][vsc-section-title align=”center” title=”DOWNLOAD NSSM” title_color=”#ffffff” subtitle_color=”#ffffff”]Download From NSSM Webpage[/vsc-section-title][vc_column_text]Head over to the NSSM Webpage and download the pre-release  Zip file so we may extract it for Windows Command Prompt.[/vc_column_text][/vc_column][/vc_row][vc_row full_width=”stretch_row_content_no_spaces” vsc_text_scheme=”darker-overlay” vsc_bg_color=”#000000″][vc_column width=”1/2″][vc_row_inner css=”.vc_custom_1424342268614{padding-top: 10px !important;}”][vc_column_inner][vsc-text-icon align=”left” type=”fontawesome” icon_fontawesome=”fa fa-question-circle-o” icon=”fa-diamond” title=”OPTIONAL”]If you already have NSSM installed, you may skip this step.[/vsc-text-icon][/vc_column_inner][/vc_row_inner][vsc-section-title align=”center” title=”EXTRACT NSSM“][/vsc-section-title][vc_column_text]Now that you have download the NSSM Zip file.  Go ahead and unzip that file and navigate to the folder that has win32 and win64 folders.  Depending on your Windows installation [More than likely 64bit] go into the correct folder.  Copy the nssm.exe file into C:/windows/system32/[/vc_column_text][/vc_column][vc_column el_class=”fullsize-wrapper” width=”1/2″ css=”.vc_custom_1503189761987{padding-right: 0px !important;padding-left: 0px !important;}”][vc_single_image image=”4278″][/vc_column][/vc_row][vc_row full_width=”stretch_row_content_no_spaces” vsc_text_scheme=”darker-overlay” vsc_bg_color=”#000000″][vc_column el_class=”fullsize-wrapper” width=”1/2″ css=”.vc_custom_1426629209543{padding-right: 0px !important;padding-left: 0px !important;}”][vc_single_image image=”4315″][/vc_column][vc_column el_align=”alignleft” width=”1/2″ css=”.vc_custom_1424436885710{padding-top: 50px !important;}”][vsc-section-title align=”center” title=”INSTALL PHP USING NSSM” title_color=”#ffffff” subtitle_color=”#ffffff”][/vsc-section-title][vc_column_text]Open up Command Prompt [Type cmd in start bar] by Right-Clicking it and selecting Run as Administrator.

Then type nssm install php

Then fill out the box like the image or with these values:


Reminder: This is assuming you have been following the guide with the installation folder as C:/nginx


Path: C:\nginx\php\php-cgi.exe

Startup Directory: C:\nginx\php

Arguments: -b 127.0.0.1:9000[/vc_column_text][/vc_column][/vc_row][vc_row full_width=”stretch_row_content_no_spaces” vsc_text_scheme=”darker-overlay” vsc_bg_color=”#000000″][vc_column width=”1/2″][vsc-section-title align=”center” title=”EDIT php.ini FILE”][/vsc-section-title][vc_column_text]Open up the file that you copied/renamed to php.ini

You will need to un-comment the following lines:

;extension_dir = "ext"
;extension=php_curl.dll
;extension=php_mbstring.dll
;extension=php_mysqli.dll
;extension=php_openssl.dll
;extension=php_pdo_mysql.dll
;extension=php_pdo_sqlite.dll
;extension=php_sqlite3.dll

If you don’t know how to un-comment, just delete the ; symbol infront of each line.

Then save the file.[/vc_column_text][/vc_column][vc_column el_class=”fullsize-wrapper” width=”1/2″ css=”.vc_custom_1503189761987{padding-right: 0px !important;padding-left: 0px !important;}”][vc_single_image image=”4327″][/vc_column][/vc_row][vc_row full_width=”stretch_row_content_no_spaces” vsc_text_scheme=”darker-overlay” vsc_bg_color=”#000000″][vc_column width=”1/2″][vc_single_image image=”4326″][/vc_column][vc_column el_class=”fullsize-wrapper” width=”1/2″ css=”.vc_custom_1503189761987{padding-right: 0px !important;padding-left: 0px !important;}”][vsc-section-title align=”center” title=”START PHP SERVICE”][/vsc-section-title][vc_column_text]In the Command Prompt that is still open with Administrator Privileges type in the following:

nssm start php[/vc_column_text][/vc_column][/vc_row][vc_row full_width=”stretch_row_content_no_spaces” vsc_text_scheme=”darker-overlay” vsc_bg_color=”#000000″][vc_column width=”1/2″][vsc-section-title align=”center” title=”EDIT nginx.conf FOR PHP”][/vsc-section-title][vc_column_text]Open up the nginx.conf file that is located at C:/nginx/conf/nginx.conf

Here is a brief overview of this page:

listen 80; This is the port that NGINX will listen on
server_name localhost; This is where you will put any domain name that you own
location / { root html; index index.html index.htm; } This is where NGINX will serve the website from

First thing we need to do is edit this line and add index.php:
index index.html index.htm;edit line to index index.php index.html index.htm;
Next we need to enable the php block so nginx knows where to send those files to process:

#location ~ \.php$ {
# root html;
# fastcgi_pass 127.0.0.1:9000;
# fastcgi_index index.php;
# fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
# include fastcgi_params;
#}

change line to

location ~ \.php$ {
root html;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}

Notice that we changed /scripts to $document_rootwhich will allow nginx to know where to pull files from[/vc_column_text][/vc_column][vc_column el_class=”fullsize-wrapper” width=”1/2″ css=”.vc_custom_1503189761987{padding-right: 0px !important;padding-left: 0px !important;}”][vc_single_image image=”4329″][/vc_column][/vc_row][vc_row full_width=”stretch_row_content_no_spaces” vsc_text_scheme=”darker-overlay” vsc_bg_color=”#000000″][vc_column width=”1/2″][vc_single_image image=”4334″][/vc_column][vc_column el_class=”fullsize-wrapper” width=”1/2″ css=”.vc_custom_1503189761987{padding-right: 0px !important;padding-left: 0px !important;}”][vsc-section-title align=”center” title=”RESTART NGINX“][/vsc-section-title][vc_column_text]In the Command Prompt that is still open with Administrator Privileges type in the following:

nssm restart nginx[/vc_column_text][/vc_column][/vc_row][vc_row full_width=”stretch_row” vsc_text_scheme=”darker-overlay” vsc_bg_color=”#0a0a0a”][vc_column][vc_empty_space][/vc_column][/vc_row][vc_row full_width=”stretch_row” vsc_text_scheme=”darker-overlay” vsc_row_type=”” bg_image=”” bg_color=”” vsc_bg_color=”#000000″][vc_column width=”4/6″][vsc-text-icon align=”right” type=”fontawesome” icon_fontawesome=”fa fa-hand-o-right” title=”CONTINUE TO NGINX REVERSE PROXIES” title_color=”#ffffff” text_color=”#ffffff” icon_color=”#ffffff”]Now that NGINX is installed and is now working with PHP, let’s do some Reverse Proxies[/vsc-text-icon][/vc_column][vc_column width=”2/6″][vsc-button text=”REVERSE PROXIES” align=”center” type=”fontawesome” icon_fontawesome=”fa fa-arrow-right” i_align=”pull-right” add_icon=”true” url=”/howtos/#reverseProxy” color=”#3a6da6″][/vc_column][/vc_row]

Leave a Reply

Your email address will not be published.