LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   sqlite with php5 on debian (https://www.linuxquestions.org/questions/linux-software-2/sqlite-with-php5-on-debian-765271/)

toredo 10-29-2009 06:47 AM

sqlite with php5 on debian
 
hello,

i installed boa and php5 on an small arm board with debian lenny. php works great.

so i installed sqlite3:
Code:

apt-get install sqlite3 php5-sqlite
now, both is installed, but if i try to execute my php-script which opens a sqlite3-database there is an error:
Quote:

Fatal error: Uncaught exception 'PDOException' with message 'safe_mode/open_basedir prohibits opening ' in /var/www/cgi-bin/Database.php:7 Stack trace: #0 /var/www/cgi-bin/Database.php(7): PDO->__construct('sqlite:') #1 /var/www/cgi-bin/Get.php(30): GetDb() #2 {main} thrown in /var/www/cgi-bin/Database.php on line 7
database.php is used in Get.php with "include 'Database.php'";

and there's a function, which opens the database:
Code:

return new PDO("sqlite:/var/www/cgi-bin/Database.sqlite3");
i changed the path much times, but it never worked.

i opened the php.ini and searched for "safe_mode" and "open_basedir".
safe_mode is disabled and open_basedir is not defined (so i'ts disabled too).

do you know why it doesnt work?

best regards
toredo

zhjim 11-17-2009 09:33 AM

I would listen to the error message. openbase_dir prevents the file from beeing open. Debian uses two config files one in /etc/php/apache and one in /etc/php/cli. Also you don't have php5-module for apache installed. Hm to be extra sure see which php.ini gets loaded by the script.

Code:

php -r "phpinfo()" | grep "php.ini"
should do the trick.
If none is loaded use the -c option to php and pass the path to the config file.
If this all does not work try to create a new php.ini with only basedir and safe_mode options inside (and turned of of cause ;))

Hope that helps
Zhjim

P.S.
Is the file writable for the user? chown user:user /path/to/db

omegas 12-30-2009 02:36 AM

Problem with php5 on arm board
 
Quote:

Originally Posted by toredo (Post 3736508)
hello,

i installed boa and php5 on an small arm board with debian lenny. php works great.

so i installed sqlite3:
Code:

apt-get install sqlite3 php5-sqlite
now, both is installed, but if i try to execute my php-script which opens a sqlite3-database there is an error:


database.php is used in Get.php with "include 'Database.php'";

and there's a function, which opens the database:
Code:

return new PDO("sqlite:/var/www/cgi-bin/Database.sqlite3");
i changed the path much times, but it never worked.

i opened the php.ini and searched for "safe_mode" and "open_basedir".
safe_mode is disabled and open_basedir is not defined (so i'ts disabled too).

do you know why it doesnt work?

best regards
toredo

I am facing nearly the same problem with you since I want to cross compile php5 with sqlite3 on the arm board installed with boa web server but it did not work. As I read your meesage, it seemed that you were successfully installed php5 on arm board and make it work without problem. Is it possible that you can send a file to me step and step to show how to cross compile php5 and install what files to make php5 works on the arm board. I have been trouble by this for a long time and as you know it is a very painful process. Thousand thanks.

php version: 5.3.0
sqlite version: 3.6.19
web server: boa

Kan


All times are GMT -5. The time now is 02:07 AM.