Search code examples
phplaravelpdocpanelvoyager

No solution here works for my "Class 'PDO' not found."


I know there are questions with similar titles here but none seem to work for me hence the reason to create a new question.

So here's the problem, i have a site that works perfectly on localhost where i am sure has PDO support but after uploading on my shared hosting i get the

Symfony \ Component \ Debug \ Exception \ FatalErrorException (E_UNKNOWN) Class 'PDO' not found

the solutions here all involve editing php.ini and installing PDO however, i am on a shared hosting without access to php.ini file or ssh.

I am using laravel 5.5, php version 7.2 with a voyager backend.

here's what my .htaccess looks like

RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{SERVER_NAME}/$1 [R,L]

<IfModule mod_rewrite.c>
    <IfModule mod_negotiation.c>
        Options -MultiViews
    </IfModule>
    RewriteEngine On

    # Redirect Trailing Slashes If Not A Folder...
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)/$ /$1 [L,R=301]

    # Handle Front Controller...
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^ index.php [L]
</IfModule>

<IfModule mime_module>
  AddType application/x-httpd-ea-php72 .php .php7 .phtml
</IfModule>

enter image description here Any help will be appreciated. Thanks.


Solution

  • Contact your Hosting support and let them enable PDO for you.

    In some hosting you can overwrite php.ini by creating php.ini file in your hosting root. These are the extensions you need to enable in php.ini if you are in windows hosting.

    extension=php_pdo.dll
    extension=php_pdo_mysql.dll
    

    Edit:

    Check if PDO is already installed by your hosting provider. Create index.php file or any other file which you can access. The content must have

    <?php
        phpinfo();
    ?>
    

    If PDO is installed already, the next thing to do is running composer install (SSH access required). You must delete your vendor folder beforehand. Assuming that your public folder is /var/www/html. go to the html directory and run

    composer install