Problem with Composer when sending to a server

Asked

Viewed 164 times

0

I am using Composer to create a site in php OO, however, when sending the files from the site to the server (which in case I am using the free service of atwebpages for external testing), the site just doesn’t work, when trying to connect with mysql it gives this error:

Fatal error: Uncaught PDOException: could not find driver in /srv/disk5/2182077/www/indieworld.atwebpages.com/Indie/Database/Connection.php:18 Stack trace: #0 /srv/disk5/2182077/www/indieworld.atwebpages.com/Indie/Database/Connection.php(18): PDO->__construct('mysql:host=fdb1...', '2182077_indie', 'indieWorld1') #1 /srv/disk5/2182077/www/indieworld.atwebpages.com/Indie/Database/IndieModel.php(19): Indie\Database\Connection->connection() #2 /srv/disk5/2182077/www/indieworld.atwebpages.com/server.php(294): Indie\Database\IndieModel->__construct() #3 /srv/disk5/2182077/www/indieworld.atwebpages.com/server.php(21): login('testando@teste....', '1234') #4 {main} thrown in /srv/disk5/2182077/www/indieworld.atwebpages.com/Indie/Database/Connection.php on line 18

On that line 18 he’s giving the error has:

$pdo = new PDO($this->iniData['driver'].':host='.$this->iniData['host'].';dbname='.$this->iniData['database'], $this->iniData['username'], $this->iniData['password']);

Do I need to install Composer via command inside the server for it to work? If so, how do I do this? I really need to solve this problem.

  • 1

    The directory vendor was sent along with the application?

  • yes, I installed Composer by cmd on my local machine and simply copied all project files (including Composer files) to the server via ftp.

  • Theoretically, if you went up to the server the whole folder vendor and is properly including the autoload.php, should work, even if the hosting blocks something.

  • Your error seems to be a configuration problem in php.ini. Can you confirm that the mysql_pdo module is loaded? You can check if it is loaded with the following code: print_r(PDO::getAvailableDrivers());

  • @jlHertel this code returns the following value : Array ( [0] => sqlite )

  • @kyro23, in this case the mysql extension for PDO is not loaded on the server. You have access to php.ini to enable it?

  • @jlHertel managed to solve, I had to ask the support staff of the server to activate this option for me. That was it! Thank you.

Show 2 more comments
No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.