{"id":231113,"date":"2022-12-28T15:30:00","date_gmt":"2022-12-28T12:30:00","guid":{"rendered":"https:\/\/wordpress.mediadoma.com\/?p=231113"},"modified":"2022-12-28T15:30:49","modified_gmt":"2022-12-28T12:30:49","slug":"przegladarka-i-terminal-pokazuja-rozne-wersje-php","status":"publish","type":"post","link":"https:\/\/wordpress.mediadoma.com\/pl\/przegladarka-i-terminal-pokazuja-rozne-wersje-php\/","title":{"rendered":"Przegl\u0105darka i terminal pokazuj\u0105 r\u00f3\u017cne wersje PHP"},"content":{"rendered":"\n<p>Je\u015bli przy ka\u017cdym uruchomieniu zobaczysz dwie r\u00f3\u017cne wersje PHP:<\/p>\n<ul>\n<li><code>php -v<\/code>w konsoli i odwied\u017a<\/li>\n<li><code>phpinfo()<\/code>w przegl\u0105darce<\/li>\n<\/ul>\n<p>Zwykle oznacza to, \u017ce wersja PHP, kt\u00f3rej u\u017cywa Tw\u00f3j serwer WWW, jest inna ni\u017c wersja PHP, kt\u00f3rej u\u017cywa Tw\u00f3j wiersz polece\u0144.<\/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=\"Przegl\u0105darka i terminal pokazuj\u0105 r\u00f3\u017cne wersje PHP\"><\/a><\/p>\n<p>W szczeg\u00f3lno\u015bci oznacza to, \u017ce prawdopodobnie masz wi\u0119cej ni\u017c jedn\u0105 instalacj\u0119, a serwer sieciowy u\u017cywa jednej wersji, a terminal u\u017cywa innej wersji (opr\u00f3cz wersji interpretera CLI).<\/p>\n<p>Oczywi\u015bcie, je\u015bli widzisz, \u017ce przegl\u0105darka i terminal pokazuj\u0105 r\u00f3\u017cne wersje PHP, oznacza to, \u017ce co\u015b jest nie tak. Chcesz, aby by\u0142y takie same, ale w zale\u017cno\u015bci od konfiguracji systemu mo\u017ce by\u0107 konieczne zaktualizowanie zmiennych \u015brodowiskowych.<\/p>\n<p>Ostatnio mia\u0142em z tym problemy z r\u00f3\u017cnymi instalacjami PHP zainstalowanymi przez <a href=\"https:\/\/wordpress.mediadoma.com\/pl\/uruchamianie-wielu-wersji-php-z-homebrew\/\" title=\"Homebrew\">Homebrew<\/a> oraz z moj\u0105 lokaln\u0105 instalacj\u0105 <a href=\"https:\/\/tommcfarlin.com\/laravel-valet-for-wordpress\/\" target=\"_blank\" rel=\"noopener nofollow\" class=\"external external_icon\">Valet<\/a>.<\/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=\"Przegl\u0105darka i terminal pokazuj\u0105 r\u00f3\u017cne wersje PHP\"><\/a><\/p>\n<p>To w\u0142a\u015bnie zrobi\u0142em, aby to naprawi\u0107.<\/p>\n<p>U\u017cywam Z-Shell i <a href=\"https:\/\/ohmyz.sh\/\" target=\"_blank\" rel=\"noopener nofollow\" class=\"external external_icon\">Oh My Zsh<\/a>, wi\u0119c by\u0107 mo\u017ce b\u0119dziesz musia\u0142 dostosowa\u0107 nast\u0119puj\u0105ce kroki, aby pasowa\u0142y do \u200b\u200bTwojej pow\u0142oki (tak jak w przypadku korzystania z Bash). Ale sedno wszystkiego jest nast\u0119puj\u0105ce.<\/p>\n<p>Najpierw musisz wiedzie\u0107, gdzie Homebrew zainstalowa\u0142 PHP. Mo\u017cna to osi\u0105gn\u0105\u0107, uruchamiaj\u0105c w <code>which php<\/code>terminalu. Powinien zwr\u00f3ci\u0107 co\u015b takiego:<\/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=\"Przegl\u0105darka i terminal pokazuj\u0105 r\u00f3\u017cne wersje PHP\"><\/a><\/p>\n<p>A odpowiednie informacje o wersji podczas uruchamiania <code>php -v<\/code>powinny wygl\u0105da\u0107 tak:<\/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=\"Przegl\u0105darka i terminal pokazuj\u0105 r\u00f3\u017cne wersje PHP\"><\/a><\/p>\n<p>Nast\u0119pnie upewnij si\u0119, \u017ce tw\u00f3j <code>zshrc<\/code>plik <a href=\"https:\/\/gist.github.com\/tommcfarlin\/10128f3afda5affbe12f9b1c8a6955cd#file-00-zshrc-sh\" target=\"_blank\" rel=\"noopener nofollow\" class=\"external external_icon\">zawiera odniesienie<\/a> do pliku binarnego, kt\u00f3ry jest powy\u017cej (i powinno by\u0107 w tej kolejno\u015bci):<\/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>Nast\u0119pnie musisz <a href=\"https:\/\/gist.github.com\/tommcfarlin\/10128f3afda5affbe12f9b1c8a6955cd#file-01-source-zshrc-txt\" target=\"_blank\" rel=\"noopener nofollow\" class=\"external external_icon\">zaktualizowa\u0107 sesj\u0119 pow\u0142oki,<\/a> aby ponownie za\u0142adowa\u0107 zmienne \u015brodowiskowe.<\/p>\n<p>Po wykonaniu tej czynno\u015bci w terminalu powinna pojawi\u0107 si\u0119 ta sama wersja, co w przyk\u0142adowym pliku PHP podczas uruchamiania <code>phpinfo()<\/code>.<\/p>\n<p><div id=\"PostUnique_PostSource\" style=\"padding-top: 50px\">\u0179r\u00f3d\u0142o nagrywania:  <a target=\"_blank\" rel=\"noopener nofollow\" href=\"\/\/tommcfarlin.com\" class=\"external external_icon\">tommcfarlin.com<\/a><\/div><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Je\u015bli widzisz, \u017ce przegl\u0105darka i terminal pokazuj\u0105 r\u00f3\u017cne wersje PHP, oznacza to, \u017ce co\u015b jest nie tak. Oto jeden ze sposob\u00f3w, w jaki mo\u017cesz to naprawi\u0107.<\/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":[721,897,805,845],"tags":[1169],"class_list":["post-231113","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-deweloper","category-kod","category-php-7","category-samouczki","tag-affiai-pl"],"_links":{"self":[{"href":"https:\/\/wordpress.mediadoma.com\/pl\/wp-json\/wp\/v2\/posts\/231113","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wordpress.mediadoma.com\/pl\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/wordpress.mediadoma.com\/pl\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/wordpress.mediadoma.com\/pl\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/wordpress.mediadoma.com\/pl\/wp-json\/wp\/v2\/comments?post=231113"}],"version-history":[{"count":0,"href":"https:\/\/wordpress.mediadoma.com\/pl\/wp-json\/wp\/v2\/posts\/231113\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/wordpress.mediadoma.com\/pl\/wp-json\/wp\/v2\/media\/159675"}],"wp:attachment":[{"href":"https:\/\/wordpress.mediadoma.com\/pl\/wp-json\/wp\/v2\/media?parent=231113"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/wordpress.mediadoma.com\/pl\/wp-json\/wp\/v2\/categories?post=231113"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/wordpress.mediadoma.com\/pl\/wp-json\/wp\/v2\/tags?post=231113"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}