NextCloud / OwnCloud occ command failing to run?

When I was attempting to run the “occ” command to either upgrade or turn on the rewrite base option for my NextCloud or OwnCloud installation I was getting the following error.

"PHP Fatal error: Class 'PDO' not found in /var/www/nextcloud/3rdparty/doctrine/db al/lib/Doctrine/DBAL/DriverManager.php on line 172"

If you do some quick searching you will find a bunch of different answers, but nothing will seem to work. But I finally found enough clues to figure out my issue. You will most likely not have either a properly configured config file in the “\etc\php5\cli\” folder or you don’t have that folder at all. If you do not have a “cli” folder in your “\etc\php5\” folder then the php-cli is running a default version of a php.ini file.

I had to create the cli folder and then I copied over my php.ini that is used by apache2 to the cli folder. Just make sure that you have the two extensions and added to the php.ini file in the cli folder. Once you have that done then your execution of the “occ” command should work without any issues!

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Scroll to Top