I have a web application written in laravel 8 and hosted on an EC2 instance running Amazon Linux 2. The application pulls in an atom feed. Previously, it worked fine. However, after some composer dependency issues (which i thought were resolved), the atom feed no longer works. Now, the following code blocks returns a Call to undefined function App\Http\Controllers\simplexml_load_string() error:
$fileContents = file_get_contents($url_map[$feed]);
$fileContents = str_replace(array("\n", "\r", "\t"), '', $fileContents);
$fileContents = trim(str_replace('"', "'", $fileContents));
$fileContents = str_replace('<p>', "", $fileContents);
$fileContents = str_replace('</p>', "", $fileContents);
$simpleXml = simplexml_load_string($fileContents);
Here's what I have already tried to resolve the issue:
I ran the following command to check if the simplexml extension is installed: php -m | grep simplexml
. It returned nothing, so my first action was to attempt to install the extension with sudo yum install php-simplexml.
However, received the following response, which suggests that the package is installed:
Package php-xml-8.2.3-1.amzn2.x86_64 already installed and latest version
Nothing to do
My next move was to open my /etc/php.ini file and look for a commented out extension=php_simplexml.dll
. However, it was nowhere in the file. I even tried to add it and restart Apache, but no luck there.
I'm running out of ideas. Does anyone have any suggestions or insight in resolving this?