{"id":3047,"date":"2021-05-31T18:33:16","date_gmt":"2021-05-31T16:33:16","guid":{"rendered":"https:\/\/www.webhostingsrbija.rs\/?p=3047"},"modified":"2021-05-31T18:33:16","modified_gmt":"2021-05-31T16:33:16","slug":"koriscenje-php-ini-iz-terminala-za-php-cli","status":"publish","type":"post","link":"https:\/\/www.webhostingsrbija.rs\/en\/koriscenje-php-ini-iz-terminala-za-php-cli\/","title":{"rendered":"Using php.ini from terminal for php-cli"},"content":{"rendered":"<p class=\"wp-block-paragraph\">When you use php commands through the terminal, it reads the system and not the local php.ini, therefore every setting locally is not read.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">In order to enable the php command to read the local php.ini file along with its options, you need to add the path of that php.ini file.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">For a list and help with php commands you have the command<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>php -h<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">To list the php.ini files and their locations which is loaded without specifying a path means the default one.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>php --ini<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Now we want to use our local php.ini<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>php -c \/home\/username\/path\/do\/php.ini \/home\/username\/public_html\/file.php<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">In this part we have a php command that starts, -c which tells which php.ini file to use, and there you need to specify the entire path to your file if it is in public_html then it should be \/home\/username\/public_html\/php.ini and replace username with your username. And if some addon is a domain, then it is some other folder and the path to php.ini in that other folder. And after the php.ini part, there is a path to the file you are calling, as in our example file.php. <\/p>\n\n\n\n<p class=\"wp-block-paragraph\">You have now launched the php.ini file from the desired location.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">If you have more commands and use them often, so that you don&#039;t have to type the path every time, you can add a line to the .bash_profile<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>alias php=&#039;php -c \/home\/username\/path\/do\/php.ini&#039;<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">And now when you restarted php-ini it would show you the local php.ini file. <\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Also for other versions of PHP use instead of php use ea-phpXX (instead of xx you put the php version like say 74 80\u2026)<\/p>","protected":false},"excerpt":{"rendered":"<p>Kada koristite php komande preko terminala onda on \u010dita sistemsku a ne lokalni php.ini stoga svako pode\u0161avanje lokalno nije o\u010ditano. Kako bi ste omogu\u0107ili da prilikom komande php \u010dita lokalni php.ini fajl zajedno sa njegovim opcijama potrebno je da dodate putanju tog php.ini fajla. Za spisak i pomo\u0107 oko php komandi imate komandu Da bi [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":3048,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"site-sidebar-layout":"default","site-content-layout":"","ast-site-content-layout":"default","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","ast-disable-related-posts":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"default","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"footnotes":""},"categories":[20],"tags":[],"class_list":["post-3047","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-cpanel"],"_links":{"self":[{"href":"https:\/\/www.webhostingsrbija.rs\/en\/wp-json\/wp\/v2\/posts\/3047","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.webhostingsrbija.rs\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.webhostingsrbija.rs\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.webhostingsrbija.rs\/en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.webhostingsrbija.rs\/en\/wp-json\/wp\/v2\/comments?post=3047"}],"version-history":[{"count":0,"href":"https:\/\/www.webhostingsrbija.rs\/en\/wp-json\/wp\/v2\/posts\/3047\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.webhostingsrbija.rs\/en\/wp-json\/wp\/v2\/media\/3048"}],"wp:attachment":[{"href":"https:\/\/www.webhostingsrbija.rs\/en\/wp-json\/wp\/v2\/media?parent=3047"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.webhostingsrbija.rs\/en\/wp-json\/wp\/v2\/categories?post=3047"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.webhostingsrbija.rs\/en\/wp-json\/wp\/v2\/tags?post=3047"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}