php implementation of SQLite like functionality - php

I am currently developping my own CMS using PHP/SQL on the server side and Javascript on the client side.
A previous version of it was pure Javascript but I realised that this was making my website unaccessible to no-script users.
I therefore shifted my paradigm to a server building a basic version and javascript providing eyecandy options.
The data are in a SQL database accessed using PDO.
Some co-workers wanted to use my CMS but they are not used to MySQL and dont like to have to migrate their databases when migrating their website (which, for many reasons, can happen quite often).
I thought of using SQLite as the database would be a simple file that could be moved easiely. However SQLite is not available in our institution professional web pages service.
I understand that using a php based impementation would limit the capabilities of load balancing (which you have when physically separating the webserver and the database) but my database would stay very small and shouldn't cause performances issues.
Question:
Is there any php impementation of SQLite that would work even when sqlite and pdsqlite modules are not available ?
Is there any other solution to have PDO fallback to a basic file-based database that could be migrated easielly ?

Try the pdo odbc adapter often this can be used.
If sqllite is not available why not go back to flatfliles especially if the data amount is not to big write json files or xml files these can be queried quiet easily especially the json files further they are easily ported.

Related

PHP connection to sharepoint database: MSSQL 2005 ODBC Driver or Webservices?

I'm trying to connect a web portal coded in PHP to a Sharepoint database. I researched and there are 2 possible options to use: MSSQL 2005 OBDC Driver and Webservices.
Which of this 2 options is the better one, and why?
https://technet.microsoft.com/en-us/library/cc793139(v=sql.90).aspx
This is an easy answer. The answer is the web services because directly querying SharePoint's databases is not allowed from a supportability standpoint (reference: https://blogs.msdn.microsoft.com/brian_farnhill/2013/12/04/directly-querying-sharepoint-databases/)
To summarize some of the core arguments is that directly talking to the database (even if it is just reads) introduces unpredictable locking of database resources which will cause problems. On top of this, the Content Database schema is not the best of my knowledge formally documented and of course subject to frequent changes. If you've ever peered inside you'll see that it is quite complicated and thus difficult to come up with generic SQL to get the data you want. The API (and therefore the web services) have done the hard work to give you a generic interface into SharePoint and to hide the complexity.
Lastly, if you are at all thinking about modifying SharePoint you are an absolute glutton for pain if you think about using direct SQL.

Calling a SQLite trigger for C++ application when PHP submits an update

I have a SQLite database populated by a C++ application. I am also working on a web interface to allow different diplays using Javascript and PHP. There will only be one instance of the interface open at any given time but it will be on another machine in the network from the SQLite file and C++ application.
There are a couple fields I would like to be able to update from the interface. I can create a trigger to let the C++ application know when data is changed, but if PHP makes the change, the trigger targets that connection and throws an error (since the callback function is defined in the C++ code). I tried enabling shared cache connections for everything involved but the SQLite trigger still can't cross the applications.
Is there a way to automatically notify the C++ application of changes or will I have to regularly poll the database if we continue using SQLite?
The documentation I've been able to find all suggest the latter, but most of it is either vague or older so I'm hoping there's a workaround I haven't been able to find.
I think that it is simply not possible to execute an own C++ function when PHP updates an SQLite database as PHP is using its internal SQLite library to update the database.
So unless you want to mess with PHP and recompile with a custom SQLite implementation (which I really recommend against) you're out of luck.
Alternatives:
You could watch the SQLite file itself on the disk, and you can execute your program if that is updated. However, filesystem watching daemons are not really working well with network drives.
Polling the database is the safest option - that always works, but might be slow, especially because you might open the same SQLite file from two programs at once.
Anyway, if you need to access the database from more than one place (PHP program and C++ program) it might be time to use a different database engine.

SPA server side framework

I am developing a new page and can not decide witch server technology I should use. I will try to describe as best I can, what I am making and hoping someone will have some advice for me.
The choice I have to made is PHP vs ASP.NET and in case of ASP.NET MsSQL vs PostgreSQL.
I must say I already spend a few months comparing and experimenting with this 2 products (and know both for many years, but for small projects).
So if I get to the point:
My web page will definitely be SPA. I don't intend to change some div content to achieve that, but open different content in dialogs or if you know KendoUI windows.
Everything else could be adapted to the selected framework. I don't plan to have many different views, but those few will heavily depend on data from database. The core of my page will be one view bind to a table with few 10/100 thousand records.
I am using jQuery to get data from server. I started with PHP, but it soon became very large project, tons of files for handling users, roles, access to file system, managing database, quering database, editing database, handling different language support... I use try version of zend studio which is great framework (you get debugger which is a little bugging from time to time) but can not compete with visual studio.
I also read on internet that all big sites (except SO) use PHP because they started small and when they became big there is no way to migrate to different server technology.
I get problems with requires files (there are to many) if I include from index.php there is different path that from AjaxCall/ProcessLogin.php. I always forgot to include some file and get unexpected result in client. ASP.NET would solve this problem. I huge disadvantage is also unknown types in PHP. I call function which return array of objects populate from database and I don't know nothing about object structure, but when using LINQ to SQL I know everything. It bothers me also that can not have 2 functions with same name and different parameters. LINQ to SQL is also amazing. And so on. Those who use both of them, you can say what advantages has developing in Visual studio c# over Zend studio in PHP.
I know (from what I read in past months) that PHP will get me better performance, that sometimes could be slower because of the interpreter. Again, I just use functions to get some data and on client side use telerik KendoUI for rendering contents.
My questions that I can not answer myself is is ASP.NET the right choise if I don't plan to use any other feature then [WebMethod] (any server side events, ASP.NET controls...)? Probably I should go with ASP.NET Web API or ASP.NET single page application? I read tutorial how can I call method with jQuery. I also found this thread. But I need to decide if I stick with PHP and do some hard work for stuff that I mention up, or I should use ASP.NET, get some really nice stuff on account of performance.
I must say that cost are not the problem. Hosting windows server, Visual studio ...
tldr; use PHP's Laravel Framework, it's a very good framework to start and it grows with you. Also it's heavily influenced by ASP.NET and Rails, just for the PHP world. Build your REST API with laravel and use jQuery for the AJAX stuff. Querying the database (e.g. postgres) with Laravel is amazing, just write something like User::where('age', 21)->get();.
Check spa-cart.com
Already much features with PHP SPA CMS

MySQL, MySQL Workbench, MAMP, and Eclipse

I am an extremely under-experienced web developer who is attempting to create a website with a couple friends. The front end stuff is all taken care of and I have been assigned to handle the back end stuff. My background is Materials Engineering, so needless to say, my programming experience relative to back end web development is non-existent. The questions I am going to ask will likely be trivial, and might not make sense at all!
I am just going to try and gain any understanding of the dynamics between MySQL, MAMP, and Eclipse.
If I use the tools provided by MAMP (phpMyAdmin) to create databases, do I then have to incorporate code into our front end code to get it to talk to the databases?
Is MySQLWorkbench a viable option to create the databases? If it is, and I create the databases and extract the code for the databases, where would this code go?
I guess I am just trying to obtain general knowledge on how to create and incorporate databases with MAMP and eclipse, when using MySQL as a database. Again, I understand this is probably trivial, so I would appreciate any information that can be provided!
Thank you.
Firstly, eclipse is simply an IDE (Integrated Development Environment), rather it is a tool that can be used to help develop your code, make sure that you are following proper syntax, etc. It is not however, a replacement for knowing a programming language.
That said, MAMP (Mac, Apache, MySQL, & PHP) is an application stack. Macintosh being the operating system, Apache being the web server that serves up your web pages, PHP being the back end programming language that (potentially) compiles the pages that Apache Servers, and MySQL being the database from which PHP pulls the data from.
As far as creating your databases, PhpMyAdmin and MySQL Workbench are both tools for helping you accomplish the task of creating your databases, tables, and potentially inserting data into these tables. However, as mentioned above you will need to use PHP or some other language, to connect to these databases and pull the information. I highly recommend checking out the PHP MySQLi and PDO MySQL libraries.

Php-Django Chimera: is it possible?

I've seen a lot of posts about switching from php to Django but none have covered this. I have a website that is built entirely in php (php 5, mysql, and apache2). This site is used only for collecting data from users. Now I need to make a second half of the site to display the data. This will be step 2 of 5 in the overall plan, and I'd rather not keep using php. I was wondering:
How hard would it be to run a Django server (hopefully on the same computer) that would serve data from the php based database?
Could python classes (inheriting from django.db.models.Model) be formed to get the data from the php database?
Could Django authentication be used with the preexisting users table?
Cheers.
Chris
Python and PHP can be run from the same server just fine. There may be performance issues on heavy loads when mixing mod_php with mod_pythong/mod_wsgi though.
Much of Django is based on its own ORM. So you would not be getting the full benefits of Django if you're serving data from a database built outside of its ORM unless you changed the schema to match directly. But to answer your questions:
The easiest way to do this would be to use django's auth system and then migrate your current users to django.

Categories