ICT / W10 & IIS & PHP / php.ini

Responsiiviset verkkosivustot, tietokonekauppa ja -huolto sekä digitointi- ja editointipalvelut » Webbiriihi.fi

php.ini asetustiedoston konfigurointi

Avaa C:\php kansiossa oleva php.ini-production tiedosto tekstieditoriin, esim. Windowsin Muistioon (Notepad) ja tallenna se nimellä php.ini C:\Windows -kansioon.

Tee php.ini tiedostoon seuraavat muutokset (lihavoidut osat) jolloin saat PHP:n perusosat toimimaan.
Huomaa, että puolipisteet (;) rivien aluissa ovat kommenttimerkkejä, joten PHP-tulkki ei lue kyseisiä rivejä. Niinpä voit huoletta kirjoittaa tiedostoon omia kommenttejasi kunhan vain muistat aloittaa kommenttirivit puolipisteillä.

Otteita php.ini-tiedostosta:

Error handling and logging

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Error handling and logging ;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

; Besides displaying errors, PHP can also log errors to locations such as a
; server-specific log, STDERR, or a location specified by the error_log
; directive found below. While errors should not be displayed on productions
; servers they should still be monitored and logging is a great way to do that.
; Default Value: Off
; Development Value: On
; Production Value: On
; https://php.net/log-errors
log_errors = On ; virheloki on oletuksena käytössä.
		
; Log errors to specified file. PHP's default behavior is to leave this value
; empty.
; https://php.net/error-log
; Example:
error_log = "C:\inetpub\temp\php-errors.log" ; virheloki ja polku siihen.

Data Handling

;;;;;;;;;;;;;;;;;
; Data Handling ;
;;;;;;;;;;;;;;;;;

; PHP's default character set is set to UTF-8
; https://php.net/default-charset
; Oletusmerkistö. Jos et käytä mitään oletuksena niin jätä arvo tyhjäksi.
default_charset = "UTF-8"

Paths and Directories

;;;;;;;;;;;;;;;;;;;;;;;;;
; Paths and Directories ;
;;;;;;;;;;;;;;;;;;;;;;;;;

; The root of the PHP pages, used only if nonempty.
; if PHP was not compiled with FORCE_REDIRECT, you SHOULD set doc_root
; if you are running php as a CGI under any web server (other than IIS)
; see documentation for security issues.  The alternate is to use the
; cgi.force_redirect configuration below
; https://php.net/doc-root
doc_root = "C:\inetpub\wwwroot" ; polku palvelimen juurikansioon

; Directory in which the loadable extensions (modules) reside.
; https://php.net/extension-dir
; extension_dir = "./"
; On windows:
extension_dir = "ext" ; PHP:n laajennuskansio

; cgi.force_redirect is necessary to provide security running PHP as a CGI under
; most web servers.  Left undefined, PHP turns this on by default.  You can
; turn it off here AT YOUR OWN RISK
; **You CAN safely turn this off for IIS, in fact, you MUST.**
; https://php.net/cgi.force-redirect
cgi.force_redirect = 0 ; CGI-asetus

; cgi.fix_pathinfo provides *real* PATH_INFO/PATH_TRANSLATED support for CGI.  PHP's
; previous behaviour was to set PATH_TRANSLATED to SCRIPT_FILENAME, and to not grok
; what PATH_INFO is.  For more information on PATH_INFO, see the cgi specs.  Setting
; this to 1 will cause PHP CGI to fix its paths to conform to the spec.  A setting
; of zero causes PHP to behave as before.  Default is 1.  You should fix your scripts
; to use SCRIPT_FILENAME rather than PATH_TRANSLATED.
; https://php.net/cgi.fix-pathinfo
cgi.fix_pathinfo = 1 ; CGI-asetus

; FastCGI under IIS (on WINNT based OS) supports the ability to impersonate
; security tokens of the calling client.  This allows IIS to define the
; security context that the request runs under.  mod_fastcgi under Apache
; does not currently support this feature (03/17/2002)
; Set to 1 if running under IIS.  Default is zero.
; https://php.net/fastcgi.impersonate
fastcgi.impersonate = 1 ; CGI-asetus

; Disable logging through FastCGI connection. PHP's default behavior is to enable
; this feature.
fastcgi.logging = 1 ; CGI-asetus

File Uploads

;;;;;;;;;;;;;;;;
; File Uploads ;
;;;;;;;;;;;;;;;;

; Temporary directory for HTTP uploaded files (will use system default if not
; specified).
; https://php.net/upload-tmp-dir
upload_tmp_dir = "C:\Temp" ; polku haluttuun latauskansioon

Dynamic Extensions

;;;;;;;;;;;;;;;;;;;;;;
; Dynamic Extensions ;
;;;;;;;;;;;;;;;;;;;;;;

; Windows Extensions
; Note that ODBC support is built in, so no dll is needed for it.
; Note that many DLL files are located in the extensions/ (PHP 4) ext/ (PHP 5)
; extension folders as well as the separate PECL DLL download (PHP 5).
; Be sure to appropriately set the extension_dir directive.
extension=curl ; voi muodostaa yhteyden ja kommunikoida useiden erityyppisten palvelimien kanssa useilla eri protokollilla
extension=fileinfo ; yrittää arvata tiedoston sisältötyypin ja koodauksen
extension=gd ; PHP:llä luotaviin kuviin
extension=mbstring ; multibyte-merkistökoodausta käytettäessä
extension=exif ; kuvien exif-tietoja käytettäessä
extension=mysql ; tietokannoissa
extension=mysqli ; tietokannoissa
extension=pdo_mysql ; tietokannoissa
extension=pdo_sqlite ; tietokannoissa

Module Settings

;;;;;;;;;;;;;;;;;;;
; Module Settings ;
;;;;;;;;;;;;;;;;;;;

[Date]
; Defines the default timezone used by the date functions
; https://php.net/date.timezone
date.timezone = "Europe/Helsinki" ; aikavyöhyke

[Session]

; where MODE is the octal representation of the mode. Note that this
; does not overwrite the process's umask.
; https://php.net/session.save-path
session.save_path = "C:\Temp" ; polku haluttuun evästekansioon