I am doing a project where a certain user can actually get/download a configuration file which is in sqlite(.db)form.
Is there any possibility where a PHP can compile the data into sqlite and directly serve it to the user?
What I knew is the PHP can actually create an sqlite db in the server. And I find it inefficient for my instance.
Related
I have an Apache server
I have several SQLite databases there
I have a PHP code there
I have an Android application which communicates with that PHP code (http post)
The PHP code gets data from the Android application and creates SQLite databases or write records there or read and so on
So the complete control over SQLite databases is with that PHP code
Now the questions are as following:
1 - Considering the file-folder access permissions, what is the PHP code called,
owner or group or world ?
2 - Is it a true structure that all users interact with that PHP code and whenever an Android user is working with the SQLite database of the server, that PHP code gives Write-Read access to the folder containing the SQLite database?
3 - Isn't there any conflict considering one user may give write access to the folder containing the SQLite database and one other user which previously had given write access has now finished the work and gives read access to the folder? while the first user needs write access yet and the other user has now changed it to read access?
4 - Isn't there any security issue if I generally give Read and Write access to the folder containing the SQLite database (Since the PHP code controls everything and I have the PHP code in non public html folder of the server)
PHP runs through a webserver, the webserver runs under a user account, access to the servers file system (usually linux) is restricted to users/groups.
So, access to a folder/file must be possible for the user account (on that server) who is running the webserver process (which is running the PHP executable).
The SQLite file should NOT be accessible from the web.
It's not that access rights are changed by the PHP process according to web-users making a request. You should make yourself familiar with how the web actually works...
I have just started using CodeIgniter for my PHP application. I need some help regarding database creation. Instead of creating database manually is it possible that when CI application in installed on any server then after starting the apache server, my application should execute some db script file to create DB structure if the DB is empty otherwise skip the DB creation. So every time when the apache server is started or restarted, my CI application should execute this script and check whether the database structure is up to date or not and create it if does not exist or not up to date.
This way I want to make sure that after first install or everytime the application runs the DB is created and ready to use.
Hope I have explained my requirement clearly. Please let me know if any kind of configuration will help me here.
I am connection to Oracle using PHP.
Now i've a file in PHP containing some data which I want to load into Oracle database table. Easiest way to do this is to read file and create insert queries to do this.
But can I load this data from my file in my server into a oracle table without uploading the file to oracle server as i don't have its FTP access?
Another consideration for bulk loading data into Oracle table(s) is the SQL Loader utility.
You don't have to upload it the ORACLE server in order to do your inserts.
I have a similar example:
I read .csv files which have a lot of records regarding used cars' makes, models
and quotes .
I have a class which reads these files ( from my local PC) prepairs insert, updates and deletes makes all these CRUD operations in a REMOTE ORACLE SERVER.
Your web server should have access, authorization, to connect to the ORACLE instance, that's all.
I have a linux machine server, I am able to use php in it. I can only connect to it using a putty command prompt or an FTP program. (basically have limited access).
Is there a way I can use a free database (like mysql)? I'm don't think I can install it on the root folders because of permissions, that's why I was thinking maybe there is a database tool that works as a standalone file, and each database is created as a resource file. That way there is no need for an installation, and you can keep the whole thing in some sub folder in the location where I do have access.
Is this possible?
I am hoping for something like, I download a file, place it on some folder after transferring it through FTP program. Then use php code to create a database and insert/delete records.
And every database created is stored as a file somewhere beside the database tool.
Use sqlite I think is just what you are looking for.
http://www.sqlite.org/about.html
I wanted to connect to my server via ssh and run a php script to enter some data into the MySQL databases.
I couldn't do this because I didn't have ssh access.
So instead I'm just going to put a php script into one of my web pages and then put the data in the same folder and then run the php by loading the browser
this seems like a really wierd way to enter data into a database?
but is it ok?
Using a PHP script to execute an SQL script should not be a problem (but be sure to delete both afterwards, just so you don't leave an unvalidated/regulated passage into your database out there).
If your webhost provides a MySQL Admin interface (often phpMyAdmin), you should be able to access that through their Control Panel (often called "cPanel" or "Plesk"). You should be able to upload and execute an SQL file through that interface without installing anything else.
Failing that, you should be able to install Adminer, which is a cutdown version of phpMyAdmin which you can then upload to your server and access through a web browser to, again, upload or copy-and-paste your SQL script into.
So you are basically rebuilding phpMyAdmin's behaviour. I would just install phpMyAdmin, but if your php script is protected (.htaccess or similar), then this should be no problem. Look out for timeouts.
A good tool for working with MySQL db is Workbench, but you must have remote access to your db...