<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>language &#8211; Mario Chivale ♦ Personal Website</title>
	<atom:link href="https://www.mario.chivale.com/tag/language/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.mario.chivale.com</link>
	<description>Mario Chivale Personal Website ♦ IT • Informatyka • Computer Science • Elektronika • Electronics • Elektryka • Electricity</description>
	<lastBuildDate>Thu, 25 May 2023 20:06:28 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9.4</generator>
	<item>
		<title>Detect Browser Language in PHP</title>
		<link>https://www.mario.chivale.com/detect-browser-language-in-php/</link>
					<comments>https://www.mario.chivale.com/detect-browser-language-in-php/#respond</comments>
		
		<dc:creator><![CDATA[Tatsu]]></dc:creator>
		<pubDate>Mon, 15 May 2023 04:44:50 +0000</pubDate>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[$_SERVER]]></category>
		<category><![CDATA[$_SERVER['HTTP_ACCEPT_LANGUAGE']]]></category>
		<category><![CDATA[browser]]></category>
		<category><![CDATA[Browser Language]]></category>
		<category><![CDATA[detect]]></category>
		<category><![CDATA[detection]]></category>
		<category><![CDATA[global]]></category>
		<category><![CDATA[global variable]]></category>
		<category><![CDATA[HTTP_ACCEPT_LANGUAGE]]></category>
		<category><![CDATA[language]]></category>
		<category><![CDATA[locale_accept_from_http]]></category>
		<category><![CDATA[Locale::acceptFromHttp]]></category>
		<category><![CDATA[substr]]></category>
		<category><![CDATA[variable]]></category>
		<guid isPermaLink="false">https://www.mario.chivale.com/?p=540</guid>

					<description><![CDATA[You can detect browser language using PHP global variable $_SERVER, exactly $_SERVER[&#8216;HTTP_ACCEPT_LANGUAGE&#8217;] EXAMPLES: 1. &#60;?php $BLang= Locale::acceptFromHttp($_SERVER[&#8216;HTTP_ACCEPT_LANGUAGE&#8217;]); echo $BLang; // Return: en ?&#62; 2. &#60;?php $BLang= locale_accept_from_http($_SERVER[&#8216;HTTP_ACCEPT_LANGUAGE&#8217;]); echo $BLang; // Return: en ?&#62; 3. Using substr function to get the first two letters of the string. &#60;?php $BLang = substr($_SERVER[&#8216;HTTP_ACCEPT_LANGUAGE&#8217;], 0, 2); echo $BLang; // Return: [&#8230;]]]></description>
										<content:encoded><![CDATA[<h1 lang="en-US" style="text-align: justify;">You can detect browser language using PHP global variable $_SERVER, exactly $_SERVER[&#8216;HTTP_ACCEPT_LANGUAGE&#8217;]</h1>
<p lang="en-US"><span style="text-decoration: underline;"><strong>EXAMPLES</strong></span>:</p>
<p lang="en-US"><strong>1</strong>.<br />
&lt;?php<br />
$BLang= Locale::acceptFromHttp($_SERVER[&#8216;HTTP_ACCEPT_LANGUAGE&#8217;]);<br />
echo $BLang; // Return: en<br />
?&gt;</p>
<p lang="en-US"><strong>2</strong>.<br />
&lt;?php<br />
$BLang= locale_accept_from_http($_SERVER[&#8216;HTTP_ACCEPT_LANGUAGE&#8217;]);<br />
echo $BLang; // Return: en<br />
?&gt;</p>
<p lang="en-US"><strong>3</strong>. Using <strong>substr</strong> function to get the first two letters of the string.<br />
&lt;?php<br />
$BLang = substr($_SERVER[&#8216;HTTP_ACCEPT_LANGUAGE&#8217;], 0, 2);<br />
echo $BLang; // Return: en<br />
?&gt;</p>
<p lang="en-US"><strong>4</strong>. Example of global variable <strong>$_SERVER[&#8216;HTTP_ACCEPT_LANGUAGE&#8217;]</strong><br />
&lt;?php<br />
$BLang = $_SERVER[&#8216;HTTP_ACCEPT_LANGUAGE&#8217;];<br />
echo $BLang; // Return: en,en-US;q=0.9,en-GB;q=0.8,en-GB-oxendict;q=0.7,en-CA;q=0.6,en-IE;q=0.5,en-AU;q=0.4,en-NZ;q=0.3,en-ZA;q=0.2,de;q=0.1,de-DE;q=0.1,de-AT;q=0.1,de-CH;q=0.1,de-LI;q=0.1,pl;q=0.1,pt;q=0.1,pt-PT;q=0.1,pt-BR;q=0.1<br />
?&gt;</p>
<div align="center"><strong>If you have any questions,<br />
write your question bellow in the &#8220;Leave a Reply&#8221; form.<br />
<em>Thanks!</em></strong></div>
<p>&nbsp;</p>
<div align="center"><a title="PayPal- Donate" href="https://www.paypal.com/donate/?hosted_button_id=5TA4H4TJHD4BJ" target="_blank" rel="noopener"><img decoding="async" title="PayPal - Donate" src="/img/paypal-donate.webp" alt="Paypal - Donate" /></a></div>
<div align="center"><strong>— Artificial Intelligence Comment —</strong></div>
<div align="center">•</div>
<p style="text-align: justify;">Detecting browser language is an important process for websites that cater to multiple audiences in different countries and languages. In this guide, we’ll discuss how to detect a user’s browser language in PHP.</p>
<p style="text-align: justify;">In today’s globalized world, it has become increasingly important for websites to be able to detect users&#8217; browser languages to provide a personalized experience. This is even more relevant for websites that offer content or services in multiple languages and cater to a wide audience.</p>
<p style="text-align: justify;">Fortunately, detecting a user’s browser language in PHP is an easy process. The most common way to detect a user’s browser language is through their <strong>HTTP Accept-Language header</strong>. This header contains the list of language codes that the user’s browser supports.</p>
<p style="text-align: justify;">To detect and analyze the Accept-Language header, we can use the <strong>$_SERVER[&#8216;HTTP_ACCEPT_LANGUAGE&#8217;]</strong> variable. It is a comma-separated string of language codes ordered by priority according to the user.</p>
<p style="text-align: justify;">Once you have the contents of the Accept-Language header, you can parse and analyze it. To do this, use the <strong>PHP explode()</strong> function. This function will break up the comma-separated list into an array of language codes.</p>
<p style="text-align: justify;">Using the array of language codes, you can loop through each one and test if it is one of the languages supported by your website. If any of the languages in the list are supported by your website, you can set it as the language for that user.</p>
<p style="text-align: justify;">In conclusion, detecting a user’s browser language in PHP is a relatively simple process. With the help of the <strong>$_SERVER[&#8216;HTTP_ACCEPT_LANGUAGE&#8217;]</strong> variable and the <strong>explode()</strong> function, it is possible to parse and analyze the user’s language preferences and provide them with a personalized experience. This can be an important factor in providing an intuitive user experience across a wide variety of users.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.mario.chivale.com/detect-browser-language-in-php/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>phpMyAdmin Deprecation Notice in PHP 8</title>
		<link>https://www.mario.chivale.com/phpmyadmin-deprecation-notice-in-php-8/</link>
					<comments>https://www.mario.chivale.com/phpmyadmin-deprecation-notice-in-php-8/#respond</comments>
		
		<dc:creator><![CDATA[Tatsu]]></dc:creator>
		<pubDate>Sat, 22 Apr 2023 12:51:04 +0000</pubDate>
				<category><![CDATA[MySQL]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[8]]></category>
		<category><![CDATA[Deprecation]]></category>
		<category><![CDATA[general]]></category>
		<category><![CDATA[general-purpose]]></category>
		<category><![CDATA[general-purpose scripting language]]></category>
		<category><![CDATA[Hypertext Preprocessor]]></category>
		<category><![CDATA[in]]></category>
		<category><![CDATA[language]]></category>
		<category><![CDATA[Notice]]></category>
		<category><![CDATA[Personal Home Page]]></category>
		<category><![CDATA[PHP 8]]></category>
		<category><![CDATA[phpMyAdmin]]></category>
		<category><![CDATA[phpMyAdmin Deprecation Notice in PHP 8]]></category>
		<category><![CDATA[purpose]]></category>
		<category><![CDATA[scripting]]></category>
		<guid isPermaLink="false">https://mario.chivale.com/?p=435</guid>

					<description><![CDATA[ERROR (example): Deprecation Notice in ./../../php/Twig/Loader/FilesystemLoader.php realpath(): Passing null to parameter #1 ($path) of type string is deprecated Backtrace FilesystemLoader.php: realpath(NULL) ./libraries/classes/Template.php: TwigLoaderFilesystemLoader-&#62;__construct(string &#8216;/usr/share/phpmyadmin//templates/&#8217;) ./libraries/classes/Theme.php: PhpMyAdminTemplate-&#62;__construct() ./libraries/classes/Theme.php: PhpMyAdminTheme-&#62;__construct() ./libraries/classes/ThemeManager.php: PhpMyAdminTheme::load( string &#8216;./themes/pmahomme&#8217;, string &#8216;/usr/share/phpmyadmin/./themes/pmahomme/&#8217;, ) ./libraries/classes/ThemeManager.php: PhpMyAdminThemeManager-&#62;loadThemes() ./libraries/classes/ThemeManager.php: PhpMyAdminThemeManager-&#62;__construct() ./libraries/classes/ThemeManager.php: PhpMyAdminThemeManager::getInstance() ./libraries/common.inc.php: PhpMyAdminThemeManager::initializeTheme() ./index.php: require_once(./libraries/common.inc.php) *** Deprecation Notice in ./../../php/Twig/Node/Node.php Return type of TwigNodeNode::getIterator() should [&#8230;]]]></description>
										<content:encoded><![CDATA[<p style="text-align: justify;"><span style="color: #ff0000;"><strong>ERROR (example)</strong></span>:</p>
<p style="text-align: justify;"><strong>Deprecation Notice</strong> in ./../../php/Twig/Loader/FilesystemLoader.php<br />
realpath(): Passing null to parameter #1 ($path) of type string is deprecated</p>
<p style="text-align: justify;"><strong>Backtrace</strong></p>
<p style="text-align: justify;">FilesystemLoader.php: realpath(NULL)<br />
./libraries/classes/Template.php: TwigLoaderFilesystemLoader-&gt;__construct(string &#8216;/usr/share/phpmyadmin//templates/&#8217;)<br />
./libraries/classes/Theme.php: PhpMyAdminTemplate-&gt;__construct()<br />
./libraries/classes/Theme.php: PhpMyAdminTheme-&gt;__construct()<br />
./libraries/classes/ThemeManager.php: PhpMyAdminTheme::load(<br />
string &#8216;./themes/pmahomme&#8217;,<br />
string &#8216;/usr/share/phpmyadmin/./themes/pmahomme/&#8217;,<br />
)<br />
./libraries/classes/ThemeManager.php: PhpMyAdminThemeManager-&gt;loadThemes()<br />
./libraries/classes/ThemeManager.php: PhpMyAdminThemeManager-&gt;__construct()<br />
./libraries/classes/ThemeManager.php: PhpMyAdminThemeManager::getInstance()<br />
./libraries/common.inc.php: PhpMyAdminThemeManager::initializeTheme()<br />
./index.php: require_once(./libraries/common.inc.php)</p>
<p style="text-align: center;"><strong>***</strong></p>
<p style="text-align: justify;"><strong>Deprecation Notice</strong> in ./../../php/Twig/Node/Node.php<br />
Return type of TwigNodeNode::getIterator() should either be compatible with IteratorAggregate::getIterator(): Traversable, or the #[ReturnTypeWillChange] attribute should be used to temporarily suppress the notice</p>
<p style="text-align: justify;"><strong>Backtrace</strong></p>
<p style="text-align: justify;">autoload.php: require(./../../php/Twig/Node/Node.php)<br />
{closure}(string &#8216;Twig\Node\Node&#8217;)<br />
TwigFilter.php: class_exists(string &#8216;Twig\Node\Node&#8217;)<br />
autoload.php: require(./../../php/Twig/TwigFilter.php)<br />
CoreExtension.php: {closure}(string &#8216;Twig\TwigFilter&#8217;)<br />
ExtensionSet.php: TwigExtensionCoreExtension-&gt;getFilters()<br />
ExtensionSet.php: TwigExtensionSet-&gt;initExtension()<br />
ExtensionSet.php: TwigExtensionSet-&gt;initExtensions()<br />
Environment.php: TwigExtensionSet-&gt;getFilter(string &#8216;error&#8217;)<br />
./../../../../../../var/lib/phpmyadmin/tmp/twig/49/49433f77d3462b2488dfef3699484854e3c55e4b348dae30482fadd1ce008731.php: TwigEnvironment-&gt;getFilter(string &#8216;error&#8217;)<br />
Template.php: __TwigTemplate_95dd0b99dd97a989e49170a5554a1e0ce6595b0346e92b70254c854745cea47e-&gt;doDisplay(<br />
array,<br />
array,<br />
)<br />
Template.php: TwigTemplate-&gt;displayWithErrorHandling(<br />
array,<br />
array,<br />
)<br />
Template.php: TwigTemplate-&gt;display(array)<br />
TemplateWrapper.php: TwigTemplate-&gt;render(<br />
array,<br />
array,<br />
)<br />
./libraries/classes/Template.php: TwigTemplateWrapper-&gt;render(array)<br />
./libraries/classes/Plugins/Auth/AuthenticationCookie.php: PhpMyAdminTemplate-&gt;render(<br />
string &#8216;login/header&#8217;,<br />
array,<br />
)<br />
./libraries/classes/Plugins/AuthenticationPlugin.php: PhpMyAdminPluginsAuthAuthenticationCookie-&gt;showLoginForm()<br />
./libraries/common.inc.php: PhpMyAdminPluginsAuthenticationPlugin-&gt;authenticate()<br />
./index.php: require_once(./libraries/common.inc.php)</p>
<p><strong><span style="color: #ff0000;">How to FIX</span></strong>:</p>
<p><span style="color: #ff0000;"><em><strong>Update your phpMyAdmin manualy&#8230;</strong></em></span></p>
<p>Enter to the directory:<br />
<strong>cd /usr/share/</strong></p>
<p>Rename your phpMyAdmin directory to phpmyadmin.bak:<br />
<strong>mv /usr/share/phpmyadmin/ /usr/share/phpmyadmin.bak</strong></p>
<p>Create a new phpMyAdmin folder:<br />
<strong>mkdir /usr/share/phpmyadmin/</strong></p>
<p>Enter to the directory:<br />
<strong>cd /usr/share/phpmyadmin/</strong></p>
<p>Download and extract phpMyAdmin:<br />
<strong>wget https://www.phpmyadmin.net/downloads/phpMyAdmin-latest-all-languages.tar.gz</strong><br />
<strong>tar xzf phpMyAdmin-*-all-languages.tar.gz</strong></p>
<p>List folders:<br />
<strong>ls</strong></p>
<p><em><strong>You should see a new folder phpMyAdmin-*-all-languages</strong></em></p>
<p>Move the contents of this folder to /usr/share/phpmyadmin:<br />
<strong>mv phpMyAdmin-*-all-languages/* /usr/share/phpmyadmin</strong></p>
<p>Make a copy of /usr/share/phpmyadmin/config.sample.inc.php:<br />
<strong>cp /usr/share/phpmyadmin/config.sample.inc.php /usr/share/phpmyadmin/config.inc</strong></p>
<p><em><strong>Edit the /usr/share/phpmyadmin/config.inc.php</strong></em></p>
<p>Search line:<br />
$cfg[&#8216;blowfish_secret&#8217;] = &#8221;; /* YOU MUST FILL IN THIS FOR COOKIE AUTH! */<br />
And change to (example):<br />
<strong>$cfg[&#8216;blowfish_secret&#8217;] = &#8216;2RQ&amp;Vb&amp;ShmZMJcSR&#8217;; /* YOU MUST FILL IN THIS FOR COOKIE AUTH! */</strong></p>
<p>Search line (example):<br />
$cfg[&#8216;TempDir&#8217;] = &#8216;/tmp&#8217;;<br />
And change to:<br />
<strong>$cfg[&#8216;TempDir&#8217;] = &#8216;/var/tmp/phpMyAdmin&#8217;;</strong><br />
if you don&#8217;t have this line (Temporary Directory Config), after line declare(strict_types=1);, add:<br />
<strong>$cfg[&#8216;TempDir&#8217;] = &#8216;/var/tmp/phpMyAdmin&#8217;;</strong></p>
<p>Create temporary directory:<br />
<strong>mkdir -p /var/tmp/phpMyAdmin</strong><br />
<strong>chown www-data:www-data /var/tmp/phpMyAdmin</strong><br />
<strong>chmod -R 700 /var/tmp/phpMyAdmin</strong></p>
<p>Cleanup:<br />
<strong>rm -rf /usr/share/phpmyadmin/phpMyAdmin-latest-all-languages.tar.gz</strong></p>
<p>Now check your new phpMyAdmin installation is working correctly, if working correctly you can delete backup folder:<br />
<strong>rm -rf /usr/share/phpmyadmin.bak</strong></p>
<div align="center"><strong>If you have any questions,<br />
write your question bellow in the &#8220;Leave a Reply&#8221; form.<br />
<em>Thanks!</em></strong></div>
<p>&nbsp;</p>
<div align="center"><a title="PayPal- Donate" href="https://www.paypal.com/donate/?hosted_button_id=5TA4H4TJHD4BJ" target="_blank" rel="noopener"><img decoding="async" title="PayPal - Donate" src="/img/paypal-donate.webp" alt="Paypal - Donate" /></a></div>
<div align="center"><strong>— Artificial Intelligence Comment —</strong></div>
<div align="center">•</div>
<p style="text-align: justify;">On November 28th, 2020, the PHP community issued a deprecation notice for the popular open source web application, phpMyAdmin. The notice came as part of the release of PHP 8, the latest version of the programming language. phpMyAdmin was originally developed as an interface used to manage MySQL databases on web servers, and has since grown into a widely used open source application that can also manage MariaDB, PostgreSQL, and other databases.</p>
<p style="text-align: justify;">The deprecation notice states that, in the interest of performance, security, and accuracy, the implementation of mysqlnd driver for phpMyAdmin will be removed in favor of mysqli (or its object-oriented variant). This new driver offers better handling of database queries and quoting of strings. The phpMyAdmin development team also noted that they will no longer support the use of the mysql extension in phpMyAdmin or any other application.</p>
<p style="text-align: justify;">In addition to these changes, the phpMyAdmin developers have also released modified versions of their existing application that are compatible with PHP 8. Users should upgrade their versions of phpMyAdmin in order to take advantage of the new features and performance improvements.</p>
<p style="text-align: justify;">The deprecation of the mysql extension in favor of mysqli has long been a worry for phpMyAdmin users. Although it may be difficult for some users to make the transition, the new benefits are hard to deny. The improved performance, security and accuracy provided by mysqli make the move to PHP 8 a wise decision for most, if not all, phpMyAdmin users.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.mario.chivale.com/phpmyadmin-deprecation-notice-in-php-8/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
