Hejka, próbuje wrzucić nowy rekord do bazy danych ale wyrzuca mi taki wyjątek
Error
PDOException: SQLSTATE[HY000]: General error: 14 unable to open database file in /var/www/html/proj2/appl/Auth.php:47 Stack trace: #0 /var/www/html/proj2/appl/Auth.php(47): PDOStatement->execute() #1 /var/www/html/proj2/soapServer.php(35): Auth->addNewUser('Zenek') #2 [internal function]: createUser('Zenek', '1234', 'Zenek') #3 /var/www/html/proj2/soapServer.php(52): SoapServer->handle() #4 {main}
Dumping request headers:
POST /proj2/soapServer.php HTTP/1.1
Host: localhost
Connection: Keep-Alive
User-Agent: PHP-SOAP/7.0.22-0ubuntu0.16.04.1
Content-Type: application/soap+xml; charset=utf-8; action="http://localhost/proj2#createUser"
Content-Length: 552
Dumping request:
Zenek1234Zenek
Dumping response headers:
HTTP/1.1 200 OK
Date: Sun, 21 Jan 2018 13:18:49 GMT
Server: Apache/2.4.18 (Ubuntu)
Content-Length: 989
Keep-Alive: timeout=5, max=100
Connection: Keep-Alive
Content-Type: application/soap+xml; charset=utf-8
Dumping response:
return<p> Error </p>PDOException: SQLSTATE[HY000]: General error: 14 unable to open database file in /var/www/html/proj2/appl/Auth.php:47
Stack trace:
#0 /var/www/html/proj2/appl/Auth.php(47): PDOStatement->execute()
#1 /var/www/html/proj2/soapServer.php(35): Auth->addNewUser('Zenek')
#2 [internal function]: createUser('Zenek', '1234', 'Zenek')
#3 /var/www/html/proj2/soapServer.php(52): SoapServer->handle()
#4 {main}
Prawa do bazy danych ma ustawione na 777 więc nie mogę znaleźć przyczyny. Czytanie mi działa i normalnie zwraca rekordy.
Nieszczęsna funkcja:
public function addNewUser($name)
{
/*$sth = self::$db->prepare("SELECT * FROM user");
$sth->execute();
$result = $sth->fetchAll();
return $result;*/
if($this->_user != '' && $this->_password != '')
{
try{
$sth = self::$db->prepare("INSERT INTO user (name, login, password) VALUES('".$name."','".$this->_user."', '".$this->_password."')");
$sth->execute();
return '1';
}catch(Exception $exc){
return "<p> Error </p>".$exc;
}
}
return "Wrong user or pass";
}