{"id":1102,"date":"2025-02-11T18:55:01","date_gmt":"2025-02-11T18:55:01","guid":{"rendered":"https:\/\/www.kolkataonweb.com\/code-bank\/?p=1102"},"modified":"2025-02-11T18:55:01","modified_gmt":"2025-02-11T18:55:01","slug":"wordpress-site-not-working-on-php-7-4-or-above","status":"publish","type":"post","link":"https:\/\/www.kolkataonweb.com\/code-bank\/php\/wordpress-site-not-working-on-php-7-4-or-above\/","title":{"rendered":"WordPress site not working on PHP 7.4 or above"},"content":{"rendered":"<p>If you are searching this then likely the PHP (and MySQL version) of your hosting got updated but your WordPress is still running a very old version say like 4.x or you need to get your very old codes running.<\/p>\n<p>The good part is the site can be made up very easily and in a short time. The beauty of PHP (python, java, .Net also) is backward compatibility is very good so in most cases very little code changes are required.<\/p>\n<ol>\n<li>First check if the code still has &#8220;<span style=\"color: #0000ff;\"><em>mysql_<\/em><\/span>&#8221; instead of &#8220;<span style=\"color: #0000ff;\"><em>mysqli_<\/em><\/span>&#8220;. If that is the case &#8211; change all &#8220;<span style=\"color: #0000ff;\"><em>mysql_<\/em><\/span>&#8221; to &#8220;<span style=\"color: #0000ff;\"><em>mysqli_<\/em><\/span>&#8220;.<\/li>\n<li>Another change required in this context is <span style=\"color: #0000ff;\"><em>mysqli_select_db<\/em> <span style=\"color: #000000;\">it now takes two parameters &#8211; <span style=\"color: #0000ff;\"><em>mysqli_select_db(connection, name)<br \/>\n<\/em><span style=\"color: #000000;\">And<\/span><em> mysqli_query <\/em><span style=\"color: #000000;\">also needs the mysql connection<\/span><em> &#8211; mysqli_query(connection, query,<\/em> resultmode)<\/span><\/span><\/span><\/li>\n<li>Next check your error log for errors.\n<ul>\n<li>One of the most common ones are variable errors like\u00a0 <span style=\"color: #0000ff;\"><em>Illegal string offset &#8216;output_key&#8217; in \/path\/to\/file<\/em><br \/>\n<span style=\"color: #000000;\">This can be solved by changing<br \/>\n<em><span style=\"color: #0000ff;\">$items[$k]-&gt;$args[&#8216;output_key&#8217;]<\/span><\/em><br \/>\nto<\/span><\/span><span style=\"color: #0000ff;\"><span style=\"color: #000000;\"><br \/>\n<em><span style=\"color: #0000ff;\">$items[$k]-&gt;{$args[&#8216;output_key&#8217;]}<\/span><\/em><br \/>\n<\/span><\/span><\/li>\n<li>Another common error is <span style=\"color: #0000ff;\">Illegal string offset &#8216;user_login&#8217;<span style=\"color: #000000;\">.\u00a0 This error causes the admin to not open. This can be solved by adding the following in <em><span style=\"color: #0000ff;\">user.php<\/span><\/em> just before <span style=\"color: #0000ff;\">$user<\/span><em><span style=\"color: #0000ff;\"><br \/>\n<\/span><\/em><\/span><\/span><\/li>\n<\/ul>\n<\/li>\n<\/ol>\n<pre class='wp-code-highlight prettyprint'>if(isset($_POST)){ \r\n$credentials = array( \r\n   'user_login' =&gt; isset($_POST['log']) ? $_POST['log'] : '',\r\n    'user_password' =&gt; isset($_POST['pwd']) ? $_POST['pwd'] :'', \r\n  ); \r\n}<\/pre>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>If you are searching this then likely the PHP (and MySQL version) of your hosting got updated but your WordPress is still running a very old version say like 4.x or you need to get your very old codes running. The good part is the site can be made up very easily and in a&hellip; <a class=\"more-link\" href=\"https:\/\/www.kolkataonweb.com\/code-bank\/php\/wordpress-site-not-working-on-php-7-4-or-above\/\">Continue reading <span class=\"screen-reader-text\">WordPress site not working on PHP 7.4 or above<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3,422],"tags":[],"class_list":["post-1102","post","type-post","status-publish","format-standard","hentry","category-php","category-wordpress","entry"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/www.kolkataonweb.com\/code-bank\/wp-json\/wp\/v2\/posts\/1102","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.kolkataonweb.com\/code-bank\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.kolkataonweb.com\/code-bank\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.kolkataonweb.com\/code-bank\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.kolkataonweb.com\/code-bank\/wp-json\/wp\/v2\/comments?post=1102"}],"version-history":[{"count":2,"href":"https:\/\/www.kolkataonweb.com\/code-bank\/wp-json\/wp\/v2\/posts\/1102\/revisions"}],"predecessor-version":[{"id":1104,"href":"https:\/\/www.kolkataonweb.com\/code-bank\/wp-json\/wp\/v2\/posts\/1102\/revisions\/1104"}],"wp:attachment":[{"href":"https:\/\/www.kolkataonweb.com\/code-bank\/wp-json\/wp\/v2\/media?parent=1102"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.kolkataonweb.com\/code-bank\/wp-json\/wp\/v2\/categories?post=1102"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.kolkataonweb.com\/code-bank\/wp-json\/wp\/v2\/tags?post=1102"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}