skip to Main Content

I’m trying to upgrade from php 5 to 7 on a server hosting a symfony project.
Actually the update from php 5 to 7 worked ;

php --version
PHP 7.2.29 (cli) (built: Mar 17 2020 11:58:47) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies
    with Zend OPcache v7.2.29, Copyright (c) 1999-2018, by Zend Technologies

but now on my server only “public” pages worked, I mean when I go a page that needs the ORM it returns a 500 internal error.
The log server file gives me this output :

[2020-03-20 14:38:49] request.CRITICAL: Uncaught PHP Exception SymfonyComponentValidatorExceptionMappingException: "Extension DOM is required." at /var/www/myProject/vendor/symfony/symfony/src/Symfony/Component/Validator/Mapping/Loader/XmlFileLoader.php line 179 {"exception":"[object] (Symfony\Component\Validator\Exception\MappingException(code: 0): Extension DOM is required. at /var/www/myProject/vendor/symfony/symfony/src/Symfony/Component/Validator/Mapping/Loader/XmlFileLoader.php:179, RuntimeException(code: 0): Extension DOM is required. at /var/www/myProject/vendor/symfony/symfony/src/Symfony/Component/Config/Util/XmlUtils.php:45)"} []
[2020-03-20 14:38:50] security.INFO: No expression found; abstaining from voting. [] []
[2020-03-20 14:38:50] security.INFO: No expression found; abstaining from voting. [] []

So I googled the error and thus I did that :

sudo yum install php72-php-mbstring php72-php-xml php72-php-xmlrpc

Then :

php -d memory_limit=-1 composer.phar update --no-cache
php -d memory_limit=-1  app/console cache:clear --env=prod
sudo systemctl restart httpd.service

And I still got this error…

EDIT :
The cli version is PHP 7.2.29 which uses /etc/opt/remi/php72/php.ini file and the server PHP (showed by phpinfo(); function ) show PHP version 7.2.28 which uses /etc/php.ini file. I think I have to investigate with some apache config.

2

Answers


  1. Chosen as BEST ANSWER

    So actually the solution was :

    1 re-link my package version with the 'good' version of PHP used by my server (uninstall and re install php 7.2)

    and 2 type sudo yum install php-sql

    That's strange but that solved my problem.


  2. You should check that extension is actually loaded.
    Do keep in mind that PHP CLI and PHP used by your webserver are two different beasts and may very well have different configuration files.
    Create a simple .php page in your project with

    <?php phpinfo();
    

    …navigate to it in your browser and see what extensions are actually loaded.

    Follow instructions from your distribution to activate missing ones.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search