{"id":1714,"date":"2014-06-01T20:00:08","date_gmt":"2014-06-02T03:00:08","guid":{"rendered":"http:\/\/www.virendrachandak.com\/techtalk\/\/?p=1714"},"modified":"2016-03-20T12:21:29","modified_gmt":"2016-03-20T19:21:29","slug":"php-5-5-password-hashing-api","status":"publish","type":"post","link":"https:\/\/www.virendrachandak.com\/techtalk\/php-5-5-password-hashing-api\/","title":{"rendered":"PHP 5.5 Password Hashing API"},"content":{"rendered":"<p>Most of the applications or websites today have a user registration system which requires storing usernames, passwords etc. A developer of the application should always store passwords securely and never in plain text. There are many methods to encrypt or hash passwords and store in the database but which method to use? The methods that are currently used are hashing password using algorithms like MD5(), SHA1(), BCRYPT.<\/p>\n<p>MD5() and SHA1() methods are now considered weak. BCRYPT is currently considered the best algorithm to use for password hashing. However, correctly implementing it can be difficult (prior to PHP 5.5). In PHP 5.5 there is a new <a href=\"http:\/\/www.php.net\/manual\/en\/intro.password.php\" title=\"Password Hashing - Introduction\" target=\"_blank\">Password Hashing API<\/a> which can be used very easily for hashing the passwords using BCRYPT algorithm.<br \/>\n<!--more--><\/p>\n<p>There is no need of any installation or enabling of extensions if you are using PHP 5.5 as this comes as part of core PHP 5.5. The new password hashing API uses four simple functions. <\/p>\n<ul>\n<li><a href=\"http:\/\/www.php.net\/manual\/en\/function.password-hash.php\" target=\"_blank\">password_hash()<\/a> \u2013 used to generate the password hash.<\/li>\n<li><a href=\"http:\/\/www.php.net\/manual\/en\/function.password-verify.php\" target=\"_blank\">password_verify()<\/a> \u2013 used to verify a password against its hash.<\/li>\n<li><a href=\"http:\/\/www.php.net\/manual\/en\/function.password-needs-rehash.php\" target=\"_blank\">password_needs_rehash()<\/a> \u2013 used to check if the given hash matches the hashing options.<\/li>\n<li><a href=\"http:\/\/www.php.net\/manual\/en\/function.password-get-info.php\" target=\"_blank\">password_get_info()<\/a> \u2013 returns the name of the hashing algorithm and various options used while hashing.<\/li>\n<\/ul>\n<h3>Hashing password<\/h3>\n<p>To hash the password we can use the password_hash() function. Here is the code that can be used for hashing the password:<\/p>\n<pre class=\"brush: php; title: ; notranslate\" title=\"\">\r\n$hash = password_hash($password, PASSWORD_DEFAULT);\r\n<\/pre>\n<p>This code will create a password hash using the default password algorithm (currently BCRYPT), default load factor (currently 10) and an automatically generated salt. The algorithm used, cost and salt are all part of the hash, so we don&#8217;t have to worry about storing all these details.<\/p>\n<p>If we don&#8217;t want to use the default values, then we can pass the different options (currently cost and salt) to the function. If we pass a salt to the function, than this will override and prevent a salt from being automatically generated. Here is an example with cost as 12 and the algorithm as BCRYPT instead of default (although currently PASSWORD_DEFAULT and PASSWORD_BCRYPT both uses BCRYPT algorithm)<\/p>\n<pre class=\"brush: php; title: ; notranslate\" title=\"\">\r\n$options = &#x5B;\r\n    'cost' =&gt; 12,\r\n];\r\n$hash = password_hash($password, PASSWORD_BCRYPT, $options);\r\n<\/pre>\n<h3>Verifying password<\/h3>\n<p>To verify if the password is correct or not we can use the password_verify() function. Here is the code that can be used for password verification.<\/p>\n<pre class=\"brush: php; title: ; notranslate\" title=\"\">\r\n\/\/ $password from user, $hash from database\r\nif (password_verify($password, $hash))\r\n{\r\n    \/\/ Valid Password.\r\n}\r\nelse\r\n{\r\n    \/\/ Invalid Password.\r\n}\r\n<\/pre>\n<h3>Rehashing Passwords<\/h3>\n<p>In case PHP changes its default hashing algorithm or you want to change the cost, then there might be need to update the password hash. To verify if the password hash needs to be updated we can use the password_needs_rehash() function. Here is the code that can be used to verify if the password needs to be rehashed.<\/p>\n<pre class=\"brush: php; title: ; notranslate\" title=\"\">\r\nif (password_needs_rehash($hash, PASSWORD_DEFAULT))\r\n{\r\n    \/\/ Password needs to be rehashed.\r\n}\r\n<\/pre>\n<p>If you were using non defaults for the original hashing, then you can use the code similar to following:<\/p>\n<pre class=\"brush: php; title: ; notranslate\" title=\"\">\r\n$options = &#x5B;\r\n    'cost' =&gt; 12,\r\n];\r\nif (password_needs_rehash($hash, PASSWORD_BCRYPT, $options))\r\n{\r\n    \/\/ Password needs to be rehashed.\r\n}\r\n<\/pre>\n<p>If we know that the password needs to be rehashed then we can just use the password_hash() function to hash the password. We can do this only on login since we will need the actual password to hash it.<\/p>\n<h3>Conclusion<\/h3>\n<p>This new API and its functions make it very easy to encrypt passwords using a secure hashing algorithm and also to verify the passwords. If your website is running on PHP 5.5, then my recommendation is to start using this new hashing API.<\/p>\n<p>Also, in case you are using PHP 5.3.7 (or later) and want to use this new API, there is a <a href=\"https:\/\/github.com\/ircmaxell\/password_compat\" target=\"_blank\">password_compat<\/a> library which provides forward compatibility with the above functions. This library automatically disables itself once you upgrade to PHP 5.5.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Most of the applications or websites today have a user registration system which requires storing usernames, passwords etc. A developer of the application should always store passwords securely and never in plain text. There are many methods to encrypt or hash passwords and store in the database but which method to use? The methods that [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"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":""}},"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_feature_clip_id":0,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2},"jetpack_post_was_ever_published":false},"categories":[143,131],"tags":[128,129],"class_list":["post-1714","post","type-post","status-publish","format-standard","hentry","category-php","category-security","tag-password","tag-password-hashing"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v28.0 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>PHP 5.5 Password Hashing API - Virendra&#039;s TechTalk<\/title>\n<meta name=\"description\" content=\"Most of the applications or websites today have a user registration system which requires storing usernames, passwords etc. A developer of the application\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.virendrachandak.com\/techtalk\/php-5-5-password-hashing-api\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"PHP 5.5 Password Hashing API - Virendra&#039;s TechTalk\" \/>\n<meta property=\"og:description\" content=\"Most of the applications or websites today have a user registration system which requires storing usernames, passwords etc. A developer of the application\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.virendrachandak.com\/techtalk\/php-5-5-password-hashing-api\/\" \/>\n<meta property=\"og:site_name\" content=\"Virendra&#039;s TechTalk\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/virendrachandak\" \/>\n<meta property=\"article:author\" content=\"https:\/\/www.facebook.com\/virendrachandak\" \/>\n<meta property=\"article:published_time\" content=\"2014-06-02T03:00:08+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2016-03-20T19:21:29+00:00\" \/>\n<meta name=\"author\" content=\"Virendra Chandak\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@virendrachandak\" \/>\n<meta name=\"twitter:site\" content=\"@virendrachandak\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Virendra Chandak\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.virendrachandak.com\\\/techtalk\\\/php-5-5-password-hashing-api\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.virendrachandak.com\\\/techtalk\\\/php-5-5-password-hashing-api\\\/\"},\"author\":{\"name\":\"Virendra Chandak\",\"@id\":\"https:\\\/\\\/www.virendrachandak.com\\\/techtalk\\\/#\\\/schema\\\/person\\\/63f7ffa1ea125e32af9618d188349e17\"},\"headline\":\"PHP 5.5 Password Hashing API\",\"datePublished\":\"2014-06-02T03:00:08+00:00\",\"dateModified\":\"2016-03-20T19:21:29+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.virendrachandak.com\\\/techtalk\\\/php-5-5-password-hashing-api\\\/\"},\"wordCount\":659,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/www.virendrachandak.com\\\/techtalk\\\/#\\\/schema\\\/person\\\/63f7ffa1ea125e32af9618d188349e17\"},\"keywords\":[\"password\",\"password hashing\"],\"articleSection\":[\"PHP\",\"Security\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.virendrachandak.com\\\/techtalk\\\/php-5-5-password-hashing-api\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.virendrachandak.com\\\/techtalk\\\/php-5-5-password-hashing-api\\\/\",\"url\":\"https:\\\/\\\/www.virendrachandak.com\\\/techtalk\\\/php-5-5-password-hashing-api\\\/\",\"name\":\"PHP 5.5 Password Hashing API - Virendra&#039;s TechTalk\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.virendrachandak.com\\\/techtalk\\\/#website\"},\"datePublished\":\"2014-06-02T03:00:08+00:00\",\"dateModified\":\"2016-03-20T19:21:29+00:00\",\"description\":\"Most of the applications or websites today have a user registration system which requires storing usernames, passwords etc. A developer of the application\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.virendrachandak.com\\\/techtalk\\\/php-5-5-password-hashing-api\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.virendrachandak.com\\\/techtalk\\\/php-5-5-password-hashing-api\\\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.virendrachandak.com\\\/techtalk\\\/php-5-5-password-hashing-api\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"TechTalk\",\"item\":\"https:\\\/\\\/www.virendrachandak.com\\\/techtalk\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"PHP\",\"item\":\"https:\\\/\\\/www.virendrachandak.com\\\/techtalk\\\/category\\\/php\\\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"PHP 5.5 Password Hashing API\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.virendrachandak.com\\\/techtalk\\\/#website\",\"url\":\"https:\\\/\\\/www.virendrachandak.com\\\/techtalk\\\/\",\"name\":\"Virendra's TechTalk\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.virendrachandak.com\\\/techtalk\\\/#\\\/schema\\\/person\\\/63f7ffa1ea125e32af9618d188349e17\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.virendrachandak.com\\\/techtalk\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\\\/\\\/www.virendrachandak.com\\\/techtalk\\\/#\\\/schema\\\/person\\\/63f7ffa1ea125e32af9618d188349e17\",\"name\":\"Virendra Chandak\",\"logo\":{\"@id\":\"https:\\\/\\\/www.virendrachandak.com\\\/techtalk\\\/#\\\/schema\\\/person\\\/image\\\/\"},\"sameAs\":[\"https:\\\/\\\/www.virendrachandak.com\",\"https:\\\/\\\/www.facebook.com\\\/virendrachandak\",\"https:\\\/\\\/www.linkedin.com\\\/in\\\/virendrachandak\\\/\",\"https:\\\/\\\/x.com\\\/virendrachandak\"]}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"PHP 5.5 Password Hashing API - Virendra&#039;s TechTalk","description":"Most of the applications or websites today have a user registration system which requires storing usernames, passwords etc. A developer of the application","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.virendrachandak.com\/techtalk\/php-5-5-password-hashing-api\/","og_locale":"en_US","og_type":"article","og_title":"PHP 5.5 Password Hashing API - Virendra&#039;s TechTalk","og_description":"Most of the applications or websites today have a user registration system which requires storing usernames, passwords etc. A developer of the application","og_url":"https:\/\/www.virendrachandak.com\/techtalk\/php-5-5-password-hashing-api\/","og_site_name":"Virendra&#039;s TechTalk","article_publisher":"https:\/\/www.facebook.com\/virendrachandak","article_author":"https:\/\/www.facebook.com\/virendrachandak","article_published_time":"2014-06-02T03:00:08+00:00","article_modified_time":"2016-03-20T19:21:29+00:00","author":"Virendra Chandak","twitter_card":"summary_large_image","twitter_creator":"@virendrachandak","twitter_site":"@virendrachandak","twitter_misc":{"Written by":"Virendra Chandak","Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.virendrachandak.com\/techtalk\/php-5-5-password-hashing-api\/#article","isPartOf":{"@id":"https:\/\/www.virendrachandak.com\/techtalk\/php-5-5-password-hashing-api\/"},"author":{"name":"Virendra Chandak","@id":"https:\/\/www.virendrachandak.com\/techtalk\/#\/schema\/person\/63f7ffa1ea125e32af9618d188349e17"},"headline":"PHP 5.5 Password Hashing API","datePublished":"2014-06-02T03:00:08+00:00","dateModified":"2016-03-20T19:21:29+00:00","mainEntityOfPage":{"@id":"https:\/\/www.virendrachandak.com\/techtalk\/php-5-5-password-hashing-api\/"},"wordCount":659,"commentCount":0,"publisher":{"@id":"https:\/\/www.virendrachandak.com\/techtalk\/#\/schema\/person\/63f7ffa1ea125e32af9618d188349e17"},"keywords":["password","password hashing"],"articleSection":["PHP","Security"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.virendrachandak.com\/techtalk\/php-5-5-password-hashing-api\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.virendrachandak.com\/techtalk\/php-5-5-password-hashing-api\/","url":"https:\/\/www.virendrachandak.com\/techtalk\/php-5-5-password-hashing-api\/","name":"PHP 5.5 Password Hashing API - Virendra&#039;s TechTalk","isPartOf":{"@id":"https:\/\/www.virendrachandak.com\/techtalk\/#website"},"datePublished":"2014-06-02T03:00:08+00:00","dateModified":"2016-03-20T19:21:29+00:00","description":"Most of the applications or websites today have a user registration system which requires storing usernames, passwords etc. A developer of the application","breadcrumb":{"@id":"https:\/\/www.virendrachandak.com\/techtalk\/php-5-5-password-hashing-api\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.virendrachandak.com\/techtalk\/php-5-5-password-hashing-api\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.virendrachandak.com\/techtalk\/php-5-5-password-hashing-api\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"TechTalk","item":"https:\/\/www.virendrachandak.com\/techtalk\/"},{"@type":"ListItem","position":2,"name":"PHP","item":"https:\/\/www.virendrachandak.com\/techtalk\/category\/php\/"},{"@type":"ListItem","position":3,"name":"PHP 5.5 Password Hashing API"}]},{"@type":"WebSite","@id":"https:\/\/www.virendrachandak.com\/techtalk\/#website","url":"https:\/\/www.virendrachandak.com\/techtalk\/","name":"Virendra's TechTalk","description":"","publisher":{"@id":"https:\/\/www.virendrachandak.com\/techtalk\/#\/schema\/person\/63f7ffa1ea125e32af9618d188349e17"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.virendrachandak.com\/techtalk\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":["Person","Organization"],"@id":"https:\/\/www.virendrachandak.com\/techtalk\/#\/schema\/person\/63f7ffa1ea125e32af9618d188349e17","name":"Virendra Chandak","logo":{"@id":"https:\/\/www.virendrachandak.com\/techtalk\/#\/schema\/person\/image\/"},"sameAs":["https:\/\/www.virendrachandak.com","https:\/\/www.facebook.com\/virendrachandak","https:\/\/www.linkedin.com\/in\/virendrachandak\/","https:\/\/x.com\/virendrachandak"]}]}},"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/p2vTtQ-rE","jetpack_sharing_enabled":true,"jetpack-related-posts":[{"id":2196,"url":"https:\/\/www.virendrachandak.com\/techtalk\/using-php-bcrypt-algorithm-for-htpasswd-generation\/","url_meta":{"origin":1714,"position":0},"title":"Generating bcrypt .htpasswd passwords using PHP","author":"Virendra Chandak","date":"September 23, 2019","format":false,"excerpt":"In my previous post we saw how to generate .htpasswd file using crypt and apr1-md5 algorithm in PHP. However, now there is a more secure BCRYPT algorithm that can be used since apache 2.4 for passwords in .htpasswd. In this post we will generate .htpasswd file using the BCRYPT algorithm\u2026","rel":"","context":"In &quot;Security&quot;","block_context":{"text":"Security","link":"https:\/\/www.virendrachandak.com\/techtalk\/category\/security\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":1673,"url":"https:\/\/www.virendrachandak.com\/techtalk\/using-php-create-passwords-for-htpasswd-file\/","url_meta":{"origin":1714,"position":1},"title":"How to generate passwords for .htpasswd using PHP","author":"Virendra Chandak","date":"March 2, 2014","format":false,"excerpt":"In my earlier post about .htaccess I had described about authentication using .htaccess and command to generate .htpasswd file. However, when we want to add passwords for many users that method will take too long, since we will have to add passwords for each user one at a time. However,\u2026","rel":"","context":"In &quot;Security&quot;","block_context":{"text":"Security","link":"https:\/\/www.virendrachandak.com\/techtalk\/category\/security\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":224,"url":"https:\/\/www.virendrachandak.com\/techtalk\/htaccess-tips\/","url_meta":{"origin":1714,"position":2},"title":".htaccess tips","author":"Virendra Chandak","date":"October 2, 2011","format":false,"excerpt":"Topics Covered: What is .htaccess file? When to use .htaccess file? Disadvantage of using .htaccess file Authentication using .htaccess file Custom Error Document Allow\/Disallow Directory Listings What is .htaccess file? .htaccess file is used on Apache Web Server to make configuration changes on per-directory basis. This file contains the configuration\u2026","rel":"","context":"In &quot;Server Configuration&quot;","block_context":{"text":"Server Configuration","link":"https:\/\/www.virendrachandak.com\/techtalk\/category\/server-configuration\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":1972,"url":"https:\/\/www.virendrachandak.com\/techtalk\/how-to-sort-a-multi-dimension-array-by-value-in-php\/","url_meta":{"origin":1714,"position":3},"title":"How to sort a multi-dimension array by value in PHP","author":"Virendra Chandak","date":"February 16, 2015","format":false,"excerpt":"In this article we will see how to sort a multi-dimension array by value of one of the keys of the array. We can use a few different methods to do this. One way to to use usort() function. Another way is to just identify the values and create another\u2026","rel":"","context":"In &quot;PHP&quot;","block_context":{"text":"PHP","link":"https:\/\/www.virendrachandak.com\/techtalk\/category\/php\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":1421,"url":"https:\/\/www.virendrachandak.com\/techtalk\/big-forms-and-php-max_input_vars\/","url_meta":{"origin":1714,"position":4},"title":"Big forms and PHP max_input_vars","author":"Virendra Chandak","date":"June 2, 2013","format":false,"excerpt":"Recently I was working in WordPress to create a big menu, with over 75 links in it. When I created it and tried to save it got save only partially, few menu items at the end got truncated. I was not sure what happened. So then I tried to add\u2026","rel":"","context":"In &quot;PHP&quot;","block_context":{"text":"PHP","link":"https:\/\/www.virendrachandak.com\/techtalk\/category\/php\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":2392,"url":"https:\/\/www.virendrachandak.com\/techtalk\/how-to-find-laravel-version\/","url_meta":{"origin":1714,"position":5},"title":"How to Check Laravel Version through CLI \/ command prompt and file","author":"Virendra Chandak","date":"May 31, 2020","format":false,"excerpt":"There are 2 easy ways to find out what version of laravel you are using. They are by running php artisian commands on CLI or checking the files. Method 1: Check Laravel Version using CLI \/ Command Prompt [sourcecode gutter=\"false\" lang=\"powershell\"] $ php artisan --version Laravel Framework 7.12.0 [\/sourcecode] The\u2026","rel":"","context":"In &quot;Laravel&quot;","block_context":{"text":"Laravel","link":"https:\/\/www.virendrachandak.com\/techtalk\/category\/laravel\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]}],"_links":{"self":[{"href":"https:\/\/www.virendrachandak.com\/techtalk\/wp-json\/wp\/v2\/posts\/1714","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.virendrachandak.com\/techtalk\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.virendrachandak.com\/techtalk\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.virendrachandak.com\/techtalk\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.virendrachandak.com\/techtalk\/wp-json\/wp\/v2\/comments?post=1714"}],"version-history":[{"count":0,"href":"https:\/\/www.virendrachandak.com\/techtalk\/wp-json\/wp\/v2\/posts\/1714\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.virendrachandak.com\/techtalk\/wp-json\/wp\/v2\/media?parent=1714"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.virendrachandak.com\/techtalk\/wp-json\/wp\/v2\/categories?post=1714"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.virendrachandak.com\/techtalk\/wp-json\/wp\/v2\/tags?post=1714"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}