Skip to content

PHP is not working after updating to PHP 8.1 RC5

After updating PHP 7.4 to PHP 8.1 RC5, PHP has stopped working on my machine and produces following error: PHP Warning: PHP Startup: ^(text/|application/xhtml+xml) (offset=0): unrecognised compile-time option bit(s) in Unknown on line 0 it produces the error even when I ask for php version: OS: Ubuntu 20.04 u…

Cannot Redirect to the correct page using PHP session

In my application I have 4 roles. As per the roles, Users can view their access different pages. Currently I am maintaining 2 different sessions. $_SESSION[‘user_id’] and $_SESSION[‘role_id’]. My problem is, suppose we say the role_id =1 is Admin, role_id=2 is Doctor. If I logout from …

PHP 8.0.12 Error Reporting Not Showing All Errors

I’m trying to move an application to PHP 8 from PHP 7. But whenever there’s an error in my code, only the first error is displayed, even if there’s a fatal error after that first error. error_reporting is set to E_ALL, display_errors and display_startup_errors are on. For example, Only the e…

How to crawl page in PHP?

I get the error: “error code: 1020″. The page I’m trying to crawl for form data is: https://v2.gcchmc.org/medical-status-search/. This is my code: $initial = file_get_contents(‘https://v2.gcchmc.org/medical-status-search/’); $check = preg_replace(‘/.+?input type=”hidd…

Is there a method in PHP to use a varible as all or part of a classname?

Example The goal is to have a dynamic variable which changes the appended string based on folder names found in a directory. Answer It is possible to use PHP to write a file that contains a class definition and then include or require that file. The newly created class could have a name based on a variable. S…