{"id":231762,"date":"2022-12-28T15:48:00","date_gmt":"2022-12-28T12:48:00","guid":{"rendered":"https:\/\/wordpress.mediadoma.com\/?p=231762"},"modified":"2022-12-28T15:50:59","modified_gmt":"2022-12-28T12:50:59","slug":"selain-ja-paeaete-naeyttaevaet-php-n-eri-versioita","status":"publish","type":"post","link":"https:\/\/wordpress.mediadoma.com\/fi\/selain-ja-paeaete-naeyttaevaet-php-n-eri-versioita\/","title":{"rendered":"Selain ja p\u00e4\u00e4te n\u00e4ytt\u00e4v\u00e4t PHP:n eri versioita"},"content":{"rendered":"\n<p>Jos satut n\u00e4kem\u00e4\u00e4n kaksi eri PHP-versiota, kun suoritat:<\/p>\n<ul>\n<li><code>php -v<\/code>konsolissa ja vieraile<\/li>\n<li><code>phpinfo()<\/code>selaimessa<\/li>\n<\/ul>\n<p>T\u00e4m\u00e4 tarkoittaa yleens\u00e4 sit\u00e4, ett\u00e4 web-palvelimesi k\u00e4ytt\u00e4m\u00e4 PHP-versio on eri kuin komentorivill\u00e4si k\u00e4ytt\u00e4m\u00e4 PHP-versio.<\/p>\n<p><a href=\"https:\/\/wordpress.mediadoma.com\/wp-content\/uploads\/2022\/01\/post-159674-61e6fa65bd75f.png\" data-rel=\"lightbox\"><img decoding=\"async\" class=\"SDStudio-light-box-enable SDStudio-editor-tools-md-imp\" src=\"https:\/\/wordpress.mediadoma.com\/wp-content\/uploads\/2022\/01\/post-159674-61e6fa65bd75f.png\" alt=\"Selain ja p\u00e4\u00e4te n\u00e4ytt\u00e4v\u00e4t PHP:n eri versioita\"><\/a><\/p>\n<p>T\u00e4m\u00e4 tarkoittaa erityisesti, ett\u00e4 sinulla on todenn\u00e4k\u00f6isesti useampi kuin yksi asennus ja verkkopalvelin k\u00e4ytt\u00e4\u00e4 yht\u00e4 versiota ja p\u00e4\u00e4te k\u00e4ytt\u00e4\u00e4 eri versiota (tulkin CLI-version lis\u00e4ksi).<\/p>\n<p>Tietenkin, jos n\u00e4et selaimen ja p\u00e4\u00e4telaitteen n\u00e4ytt\u00e4v\u00e4n eri PHP-versioita, jokin on vialla. Haluat niiden olevan samat, mutta riippuen siit\u00e4, miten j\u00e4rjestelm\u00e4si on m\u00e4\u00e4ritetty, saatat joutua p\u00e4ivitt\u00e4m\u00e4\u00e4n ymp\u00e4rist\u00f6muuttujasi.<\/p>\n<p>Minulla oli \u00e4skett\u00e4in ongelmia t\u00e4m\u00e4n kanssa <a href=\"https:\/\/wordpress.mediadoma.com\/fi\/useiden-php-versioiden-kaeyttaeminen-homebrewilla\/\" title=\"Homebrew'n\">Homebrew&#8217;n<\/a> kautta asennettujen PHP-asennusten ja paikallisen <a href=\"https:\/\/tommcfarlin.com\/laravel-valet-for-wordpress\/\" target=\"_blank\" rel=\"noopener nofollow\" class=\"external external_icon\">Valet<\/a> -asennukseni kanssa .<\/p>\n<p><a href=\"https:\/\/wordpress.mediadoma.com\/wp-content\/uploads\/2022\/01\/post-159674-61e6fa6ac1261.png\" data-rel=\"lightbox\"><img decoding=\"async\" class=\"SDStudio-light-box-enable SDStudio-editor-tools-md-imp\" src=\"https:\/\/wordpress.mediadoma.com\/wp-content\/uploads\/2022\/01\/post-159674-61e6fa6ac1261.png\" alt=\"Selain ja p\u00e4\u00e4te n\u00e4ytt\u00e4v\u00e4t PHP:n eri versioita\"><\/a><\/p>\n<p>T\u00e4m\u00e4n tein korjatakseni sen.<\/p>\n<p>K\u00e4yt\u00e4n Z-Shellia ja <a href=\"https:\/\/ohmyz.sh\/\" target=\"_blank\" rel=\"noopener nofollow\" class=\"external external_icon\">Oh My Zshia,<\/a> joten saatat joutua mukauttamaan seuraavat vaiheet vastaamaan kuoriasi (kuten jos k\u00e4yt\u00e4t Bashia). Mutta kaiken ydin on seuraava.<\/p>\n<p>Ensin sinun on tiedett\u00e4v\u00e4, mihin Homebrew on asentanut PHP:n. T\u00e4m\u00e4 voidaan suorittaa ajamalla <code>which php<\/code>terminaalissa. Sen pit\u00e4isi palauttaa jotain t\u00e4llaista:<\/p>\n<p><a href=\"https:\/\/wordpress.mediadoma.com\/wp-content\/uploads\/2022\/01\/post-159674-61e6fa722faa3.png\" data-rel=\"lightbox\"><img decoding=\"async\" class=\"SDStudio-light-box-enable SDStudio-editor-tools-md-imp\" src=\"https:\/\/wordpress.mediadoma.com\/wp-content\/uploads\/2022\/01\/post-159674-61e6fa722faa3.png\" alt=\"Selain ja p\u00e4\u00e4te n\u00e4ytt\u00e4v\u00e4t PHP:n eri versioita\"><\/a><\/p>\n<p>Ja vastaavien versiotietojen <code>php -v<\/code>pit\u00e4isi ajettaessa n\u00e4ytt\u00e4\u00e4 t\u00e4lt\u00e4:<\/p>\n<p><a href=\"https:\/\/wordpress.mediadoma.com\/wp-content\/uploads\/2022\/01\/post-159674-61e6fa7727cdd.png\" data-rel=\"lightbox\"><img decoding=\"async\" class=\"SDStudio-light-box-enable SDStudio-editor-tools-md-imp\" src=\"https:\/\/wordpress.mediadoma.com\/wp-content\/uploads\/2022\/01\/post-159674-61e6fa7727cdd.png\" alt=\"Selain ja p\u00e4\u00e4te n\u00e4ytt\u00e4v\u00e4t PHP:n eri versioita\"><\/a><\/p>\n<p>Seuraavaksi sinun on varmistettava, ett\u00e4 <code>zshrc<\/code>tiedostosi <a href=\"https:\/\/gist.github.com\/tommcfarlin\/10128f3afda5affbe12f9b1c8a6955cd#file-00-zshrc-sh\" target=\"_blank\" rel=\"noopener nofollow\" class=\"external external_icon\">sis\u00e4lt\u00e4\u00e4 viittauksen<\/a> yll\u00e4 tulostettuun binaariin (ja sen pit\u00e4isi olla t\u00e4ss\u00e4 j\u00e4rjestyksess\u00e4):<\/p>\n<pre><code># If you come from bash you might have to change your $PATH.\n# export PATH=$HOME\/bin:\/usr\/local\/bin:$PATH\n\n# Path to your oh-my-zsh installation.\nexport ZSH=\"\/Users\/tommcfarlin\/.oh-my-zsh\"\n\n# Set name of the theme to load --- if set to \"random\", it will\n# load a random theme each time oh-my-zsh is loaded, in which case,\n# to know which specific one was loaded, run: echo $RANDOM_THEME\n# See https:\/\/github.com\/robbyrussell\/oh-my-zsh\/wiki\/Themes\n# ZSH_THEME=\"robbyrussell\"\nZSH_THEME=\"avit\"\n\n# Set list of themes to pick from when loading at random\n# Setting this variable when ZSH_THEME=random will cause zsh to load\n# a theme from this variable instead of looking in ~\/.oh-my-zsh\/themes\/\n# If set to an empty array, this variable will have no effect.\n# ZSH_THEME_RANDOM_CANDIDATES=( \"robbyrussell\" \"agnoster\") # Uncomment the following line to use case-sensitive completion.\n# CASE_SENSITIVE=\"true\"\n\n# Uncomment the following line to use hyphen-insensitive completion.\n# Case-sensitive completion must be off. _ and - will be interchangeable.\n# HYPHEN_INSENSITIVE=\"true\"\n\n# Uncomment the following line to disable bi-weekly auto-update checks.\n# DISABLE_AUTO_UPDATE=\"true\"\n\n# Uncomment the following line to change how often to auto-update (in days).\n# export UPDATE_ZSH_DAYS=13\n\n# Uncomment the following line to disable colors in ls.\n# DISABLE_LS_COLORS=\"true\"\n\n# Uncomment the following line to disable auto-setting terminal title.\n# DISABLE_AUTO_TITLE=\"true\"\n\n# Uncomment the following line to enable command auto-correction.\nENABLE_CORRECTION=\"true\"\n\n# Uncomment the following line to display red dots whilst waiting for completion.\nCOMPLETION_WAITING_DOTS=\"true\"\n\n# Uncomment the following line if you want to disable marking untracked files\n# under VCS as dirty. This makes repository status check for large repositories\n# much, much faster.\n# DISABLE_UNTRACKED_FILES_DIRTY=\"true\"\n\n# Uncomment the following line if you want to change the command execution time\n# stamp shown in the history command output.\n# You can set one of the optional three formats:\n# \"mm\/dd\/yyyy\"|\"dd.mm.yyyy\"|\"yyyy-mm-dd\"\n# or set a custom format using the strftime function format specifications,\n# see 'man strftime' for details.\n# HIST_STAMPS=\"mm\/dd\/yyyy\"\n\n# Would you like to use another custom folder than $ZSH\/custom?\n# ZSH_CUSTOM=\/path\/to\/new-custom-folder\n\n# Which plugins would you like to load?\n# Standard plugins can be found in ~\/.oh-my-zsh\/plugins\/*\n# Custom plugins may be added to ~\/.oh-my-zsh\/custom\/plugins\/\n# Example format: plugins=(rails git textmate ruby lighthouse)\n# Add wisely, as too many plugins slow down shell startup.\nplugins=(vscode)\n\nsource $ZSH\/oh-my-zsh.sh\n\n# User configuration\n\n# export MANPATH=\"\/usr\/local\/man:$MANPATH\"\n\n# You may need to manually set your language environment\n# export LANG=en_US.UTF-8\n\n# Preferred editor for local and remote sessions\n# if [[ -n $SSH_CONNECTION ]]; then\n#   export EDITOR='vim'\n# else\n#   export EDITOR='mvim'\n# fi\n\n# Compilation flags\n# export ARCHFLAGS=\"-arch x86_64\"\n\n# Set personal aliases, overriding those provided by oh-my-zsh libs,\n# plugins, and themes. Aliases can be placed here, though oh-my-zsh\n# users are encouraged to define aliases within the ZSH_CUSTOM folder.\n# For a full list of active aliases, run `alias`.\n#\n# Example aliases\n# alias zshconfig=\"mate ~\/.zshrc\"\n# alias ohmyzsh=\"mate ~\/.oh-my-zsh\"\n#export PATH=\"\/usr\/local\/sbin:$PATH\"\n#export PATH=\"\/usr\/local\/sbin:$PATH\"\nexport PATH=\"\/usr\/local\/opt\/icu4c\/bin:$PATH\"\nexport PATH=\"\/usr\/local\/opt\/icu4c\/sbin:$PATH\"\nexport PATH=\"\/usr\/local\/bin:$PATH\"\nexport PATH=\"\/usr\/local\/sbin:$PATH\"\nexport PATH=\"\/usr\/local\/opt\/php@7.2\/bin:$PATH\"\nexport PATH=\"\/usr\/local\/opt\/php@7.2\/sbin:$PATH\"\nexport PATH=~\/.composer\/vendor\/bin:$PATH\n<\/code><\/pre>\n<p>Seuraavaksi sinun on <a href=\"https:\/\/gist.github.com\/tommcfarlin\/10128f3afda5affbe12f9b1c8a6955cd#file-01-source-zshrc-txt\" target=\"_blank\" rel=\"noopener nofollow\" class=\"external external_icon\">p\u00e4ivitett\u00e4v\u00e4 shell-istunto<\/a>, jotta voit ladata ymp\u00e4rist\u00f6muuttujat uudelleen.<\/p>\n<p>Kun olet tehnyt t\u00e4m\u00e4n, sinun pit\u00e4isi n\u00e4hd\u00e4 terminaalissa sama versio kuin PHP-mallitiedostossa, kun suoritat <code>phpinfo()<\/code>.<\/p>\n<p><div id=\"PostUnique_PostSource\" style=\"padding-top: 50px\">:  <a target=\"_blank\" rel=\"noopener nofollow\" href=\"\/\/tommcfarlin.com\" class=\"external external_icon\">tommcfarlin.com<\/a><\/div><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Jos n\u00e4et selaimen ja p\u00e4\u00e4telaitteen n\u00e4ytt\u00e4v\u00e4n eri PHP-versioita, jokin on vialla. T\u00e4ss\u00e4 on yksi tapa korjata tilanne.<\/p>\n","protected":false},"author":1,"featured_media":159675,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":"","_wp_rev_ctl_limit":""},"categories":[719,895,843,803],"tags":[1166],"class_list":["post-231762","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-kehittaejae","category-koodi","category-opetusohjelmia","category-php-5","tag-affiai-fi"],"_links":{"self":[{"href":"https:\/\/wordpress.mediadoma.com\/fi\/wp-json\/wp\/v2\/posts\/231762","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wordpress.mediadoma.com\/fi\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/wordpress.mediadoma.com\/fi\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/wordpress.mediadoma.com\/fi\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/wordpress.mediadoma.com\/fi\/wp-json\/wp\/v2\/comments?post=231762"}],"version-history":[{"count":0,"href":"https:\/\/wordpress.mediadoma.com\/fi\/wp-json\/wp\/v2\/posts\/231762\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/wordpress.mediadoma.com\/fi\/wp-json\/wp\/v2\/media\/159675"}],"wp:attachment":[{"href":"https:\/\/wordpress.mediadoma.com\/fi\/wp-json\/wp\/v2\/media?parent=231762"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/wordpress.mediadoma.com\/fi\/wp-json\/wp\/v2\/categories?post=231762"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/wordpress.mediadoma.com\/fi\/wp-json\/wp\/v2\/tags?post=231762"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}