Open-source generic web service to database interface? - php

I'm looking for a thin, generic layer (probably written in PHP) that sits between a database (probably MySQL) and web service clients (which could be anything). I imagine there would be config files of some sort that tell it how to map web service requests to database queries (or other DB commands). It would also need to handle authentication and authorization, of course.
I've done some googling but failed to find anything that fits the bill. Can anyone suggest something like this?

This is the right framework for your needs - http://sourceforge.net/projects/phprestsql/

Well, there are all sorts of PHP database frameworks that may very well fit the bill.
Most obvious is PDO, which is really just a set of classes for working with the database. It's baked into PHP 5.1+ so it doesn't even require a download.
Others are more complete, and do all sorts of work for you.
Prado (Which gained features and size with the latest forks)
Zend_DB
And search Google for a massively large list.
Hope that helps.

phpMyAdmin might be what you are looking for.

Related

How to integrate two different applications ? Web applications

Hi all i am a Student working on a project in an Hospital we designed an application where patient can book an appointment with doctor similar to this application (apphp.com/php-medical-appointment/examples/sample2/index.php) and our application uses php and mysql and runs on microcms framework now what we are trying to do is to get this application integrated with MedTrak (http://www.intersystems.com/trakcare/) which uses CACHE DB (Intersystems Cache db a post relational db)
we have written our application using mysql so is there any possible ways that we can fire data from our application to their db and. get, data from their db
So far we have tried these methods
odbc will it work cause we have to write our application in ODBC again
Help
Enterprise Application Patterns is a great book and I highly recommend it. However, I would add that even if you had top notch messaging middle-ware available to ensure the 2 applications are as loosely coupled as possible, at some point you will have to read or write to the Cache database, and you will probably need both.
Also, a sophisticated approach to integration may or may not be feasible on a student project. Perhaps it would be sufficient to have most of your code talk to an abstract communication layer that encapsulates the exact integration? You could start with whatever is simplest to implement but could have a story about how it could be changed later. Even this is probably quite hard enough for a student project, since the interface really should assume the communication is asynchronous.
In any case, at some point the rubber will meet the road and you will have to read and/or write to the Cache database. And at that point, ODBC is available, and sounds like it would be a good choice for you. There are other methods to connect to Cache but ODBC is widely used (and therefore probably more reliable) and doesn't require you to learn Cache Object Script, which would be a lot of extra work for your situation.
There are many ways to achieve this - the best way to learn about this is to read "Enterprise Integration Patterns".
I wouldn't recommend writing directly to each other's database - it is a fragile way of gluing apps together, because a change in one schema requires you to change the other app at the exact same time. You have to deal with exotic failure modes - one database may be down for backups, which means you can't write the changes from the other database to it.
Read the book for alternatives!

Thoughts on converting PHP app to ROR for use with Heroku?

I'm in the process of building a rather big web application with PHP + Codeigniter. When I first began this project I was excited by the hosting provider PHPFog product of PHP-as-a-service. The idea of simply developing my application and not having to worry about server maintenance, setup, securing, etc appealed to me.
However, I've had far too many issues with PHPFog to be comfortable trusting it with hosting my application. I've run into situations where I've deleted a file from my git repository, pushed it to my remote repo at phpfog, and wound up with the file not actually being removed on one or all of my application servers. The service is also supposed to provide newrelic for application monitoring however this only worked briefly and hasn't worked at all since August 10th despite numerous complaints. And their customer service is far from satisfactory in helping solve all of these problems.
So now I'm considering alternatives, and Heroku has caught my attention. Heroku seems like a much more mature cloud application platform. However it does not provide PHP hosting. Instead it provides ROR, Java, Node.js, and Clojure.
How difficult would it be for someone with a lot of experience in PHP (and the Codeigniter framework) to learn Ruby + Rails and rebuild an application? Both organize code in the MVC pattern, so I hope that means my views would only require modification of their hooks to match ruby's syntax. I've already designed my database and all of the SQL queries to access the data I need from my models in CI. What do you guys think?
EDIT 1:
So I've watched this video as an introduction to ROR development:
http://www.youtube.com/watch?v=Gzj723LkRJY
And my initial reaction is 'So ROR is like a coloring book?' I'm skeptical when I see huge chunks of an application come together via something as simple 'scaffolding.' I don't know what to think other than I'm afraid that ROR sacrifices some of the granularity/control I'm used to with php
EDIT 2:
I've recently discovered https://cloudcontrol.com/ They appear to offer the same type of hosting with PHP-as-a-service that PHPFog offers but with more control, such as the ability to directly access your database and auto-scaling. Still the great idea of a git-push to deploy to multiple servers without having to deal with setting them up manually. The only thing I dislike is that their datacenters are based in Ireland (Amazon AWS). However they told me that they're planning on moving to the US in the next 3 months and offering pricing in USD.
While yes they both are MVC, yes both Ruby and PHP are scripting languages, and yes you shouldn't require much modification to your views other than changing the php hooks to ruby hooks, I think you are fooling yourself if you think it is just an easy conversion.
Ruby as a language is IMO far superior to PHP. It allows you to do so much more with so much less code. If you were to convert your PHP code to Ruby code by replacing each call with its equivalent, you wouldn't be doing it the Ruby way.
On top of that, Rails as a framework is far more mature and powerful than CodeIgniter. It will provide you far greater flexibility and convention-based help that you will code things a lot differently than if you were using CI.
Added to that, you will want to use ActiveRecord as your ORM and should write database migrations to create your database, so all those SQL scripts you have written will be pretty much useless.
If you decide that porting your app to RoR is the way to go, then I wholeheartedly encourage you to take some time and learn Ruby and Rails, and then rewrite your application as if you were doing a Rails app from scratch. You'll be amazed at how quickly you can get a project up and running.
Before this question turns into the typical Ruby vs PHP discussion, and before you embark on an (almost) impossible task, you should consider other hosting providers. There are many to choose from, some of whom offer this "PHP as a service" you're looking for.
http://vps.net/
http://mediatemple.net/
http://rackspace.com/
Please realize that porting a PHP application to ROR or Ruby is not an easy task. You may as well start again (in a language you know little about, no doubt). You shouldn't base your programming language on bad hosting experience or whatever that guy said. Use what you're comfortable with.
This one is a must read for you
http://www.oreillynet.com/ruby/blog/2007/09/7_reasons_i_switched_back_to_p_1.html

What are the relative advantages of various Python/PHP web frameworks (particularly for my project)?

I'm deciding on a web framework for an upcoming project, and I'd appreciate any advice. We've decided to use jQuery for the JavaScript, and are heavily leaning toward Python or PHP (more Python) for our server-side logic. I'm especially interested in web2py because of its jQuery integration.
About our project
Our project is to develop a security console for a complex
cybersecurity system operating within an organization's internal
network.
This console will be largely server-driven, as messages come in from the network and must be pushed by the server to the user.
The user will also be able to initiate security actions, the implementation for which will likely be in C++.
The interface we've planned will be relatively rich, and I want to leverage jQuery's power as much as possible.
We have some control over the browser environment we'll be running in (e.g., we don't have to worry about clients with JavaScript disabled).
Our site is likely to have only a few, long-lived client connections.
We are looking for software components with permissive licenses, though we're using some copyleft components (I see that web2py is LGPL while Django is BSD, so +1 to Django)
We have about a month to create a functional demo of our system, of which this interface is a small (but visible) part.
About us
We are two developers with about 5 years of programming experience, but little web development experience. I have several years of Python experience and a summers' worth of experience messing around with PHP. My coworker has some Python experience and has never touched PHP.
I used Django once back in 2008, and was frustrated by the file and code structure, which I found highly unintuitive. Perhaps this structure is inherent to the MVC model (I've had similar experiences with Django and CakePHP since), and I just need to bite the bullet and memorize it.
My Question
Given the information above, what are the relative advantages of the various Python/PHP web frameworks for our project? As mentioned above, I'm especially interested in web2py because of its jQuery integration, though Django's dominance is (once again) hard to ignore.
Thank you very much for your time!
Before deciding on a framework, you should first decide if you want to commit to a language you are unfamiliar with.
You said you've both got minimal PHP experience, so you have to weigh up the advantages here; Will the pros for going PHP (if any) out weigh the amount of time the developers will need to spend to retrain?
(Although depending on your background experience, PHP should be very easy to pick up.)
If you frame it like that, PHP would have to have a pretty convincing offering to give you. From what I'm seeing, specifically Django vs web2py, they both seem very close in functionality - which is good, but doesn't provide the "you must use x!" scenario you may be after.
However, If you will be bringing more people in later and feel finding people to work with web2py will be difficult, it may tip it to PHP. You said your self, Django's popularity (and BSD license) is hard to ignore, and it should make it easier to find people for later expansion.
If it were me, in your shoes, I would go with web2py. Assuming the development team will continue to be Python focused for the foreseeable future.
Python vs PHP: Python
With python, you can always write wrappers for C code so you won't have to mess with starting other processes and passing args to them. That might be useful for your security functions.
Web2py will allow you to easily write a webservice for this too, to more easily integrate the C portions with the web-site infrastructure.
If you already prefer python, I would go with that. If you need to bring on web-developers later that are trained in PHP, teach them Python. It won't take long, and I'm sure they'll appreciate it in the long run. Plus, moving from a PHP MVC framework to web2py or even django would make things easier. I've used CodeIgniter for PHP and find that web2py was so much simpler and easy to understand.
Also as for the directory structure, django is not actually true MVC -- it's MTV (model, template, view).
I find web2py's organization a little more straight-forward. But yes, either way it can seem strange at first. I would say YES, you should bite the bullet and use MVC.
In web2py, the "view" is html markup with the ability to write raw python code. The controller extracts data from the model (database), attaches any needed files (css/js etc) and the model of course simply defines the structure of the data and allows you to access it in an OO way.
Lastly, I wouldn't tip my hat in favor of web2py just because of jQuery integration. It does use it, and a some of the built-in framework stuff (like response.flash/session.flash, the LOAD function that loads a page or data from another controller) rely on jQuery, but using it in another framework only means you have to write an include statement (e.g. ).
But, the way it allows/forces you to focus on development is what takes the cake for me.
I've been using Django as part of my work for a couple years now and truly enjoy it when I can make it work. Unfortunately, and maybe it's just me, but I end up spending hours working on configuration every time I start a new server, or try to make it work in a development IDE.
It's relatively simple to start a new project and start coding. But there are all sorts of little catches that keep things from working if you deviate from the norm. Things like if you want your django project to serve from a subdirectory like example.com/django. The information is out there to make it work. But it's hard to find.
I can't tell you if web2py has those same problems or not. I only just learned about it from your question. It does look slick and simple though. I can tell you that after the hassles of getting the applications to serve properly from whatever server configuration I'm using, django is way more fun to program with than plain php. PHP frameworks may differ.
From my understanding the project not usual web application, you must need event driven program, web server in python.
Django won't help you here.You should look into Flask, Flask has inbuilt console too.http://werkzeug.pocoo.org/, you might need to use twisted, gevent,Flask jquery.
I would recommend asking about web2py on its mailing list -- you'll get lots of help and advice there. Regarding the LGPL license, note that it only applies to the framework, not your application -- you can license your application however you like, including closed source/commercial.
It sounds like you'll need some server push functionality, but if you'll really only need a few long-lived connections at a time, you might not need to bother with solutions like Twisted or gevent. If necessary, though, web2py does include this (requires Tornado, and works using WebSockets, though can be adapted to use other methods).

Using PHP for medium to high-load public websites

I am planing to build a website using PHP to be hosted on the public internet with decent user load (between 1000 to 5000). I am using FreeBSD as a server and I configured Apache, PHP and MySQL from scratch.
With proper configuration, is it safe to use such a server, or should I go with some web framework? I am asking as I've heard few horrible things about PHP.
If it is safe, does PHP get too complex when the size of the site increases beyond a certain point?
I know Facebook uses PHP; are there any other big websites that use PHP?
Last, is it recommended to use some PHP framework or should I stick to plain old PHP?
PHP works fine for just about any size server. The question isn't really the programming language but the infrastructure you set up. 1000-5000 users is not very many unless they are all banging on the site at the same time. Are they doing a lot of DB queries or consuming a lot of CPU resources? If so, then you may want to look at a dedicated MySQL server for the DB queries.
I have nothing against frameworks. However, you are usually shoehorning your problem into their solution. Careful design on your part with common routines, etc., are usually just as good as a framework in my opinion. However, some people are more comfortable working within a framework because it removes some of the plumbing issues.
A lot of large sites use PHP. It may not be obvious because they hide the extension of the scripts in the URLs.
With proper configuration PHP is fine. However if youre new to php and server administration you might want to read up on configuring php as well as Apache for security. Youll also need to read specifics on configuration for performance as well but you need to have an app to test before its really worth doing that beyond some basics.
As far as using a framework or just basic PHP that depends totally on you. a framework is othing more really than a set of useful code and structure to accomplish alot of tasks. If you dont use a framework youre going to have to write code that meets similar requirements, so you might save time using a framework. Generally you are going to sacrifice performance in trade for having to design/write less code. You need to decide yourself if a framework (and which one) is right for the project.
In terms of sites that use php... There are a ton... Facebook, Yahoo Bookmarks, Daily Motion, parts of MySpace (at one time, not sure if its still the case), anything running Drupal or Wordpress... PHP is more than capable.
PHP is just a tool and choice of framework does not really makes your application secure or fast, unless you understand the principles of web security and how things works.
Facebook is good example of what php is capable of in hands of processionals. And there are plenty of websites that capable to handle 10K visitors a day on a single low end server.

Desktop software development (possibly using web technology) and cryptographic checks

OK, go easy on me as it's my first question here. ;)
I am experienced in Web Application development, but I need to design 2 different desktop applications at work. I need advice on what languages to use (I use PHP for Web Applications, I have little other experience), any frameworks that may help me accomplish this easier and any IDEs to use to make my life easier too.
My first application will essentially be an interface to an embedded or remote DB and essentially it needs to do not much more than CRUD. A fulltext search function will be necessary as will sorting of the CRUD table too. I'd like to include the possibility of hiding columns of data too, but this isn't a priority. I currently use MySQL, but am happy to use any other DB, as long as they support importing from Excel. Of course, if it supports an excel spreadsheet as the database, fantastic, but wishful thinking...
I only need to support Windows XP upwards, this won't change. Let me know if I can add anything to help answer this.
My second application is going to be more complicated, I guess. It needs to output the SHA, MD5, CRC-32, CRC-16 signatures for an entire external drive on-screen and/or into a text document of the users choice (new and append). The external drive could be Compact Flash, EEPROM, CD-ROM, DVD-ROM, SD, etc. Whereas I have an idea where to start on the first application, this one is where I need major help as I have no idea which programming language has built-in support for all the algorithms above, or the best way to go about coding it. So any and all advice will be more than welcome.
Edit: OK, so I have come across Titanium and am wondering if this is the best option out there for my 2 projects. The first one I am certain I can achieve, but the second project is going to be pretty difficult I believe, as unlike most hash calculators out there, I do not only need to check individual files for SHA/MD5/CRC-32/CRC-16, but I also need to check Compact Flash through a USB-connected Sandisk CF reader and EEPROMs through a COM or USB connection as well. I essentially need to produce the signature/hash for the entire drive, not the files on it. Any advice on this in particular would be helpful, please let me know if I am going too far off-topic by stackoverflow standards, as I can create a new question with this in.
I'm going to have to say Perl might be a good (though not necessarily the best) option for you, if you aren't one of the PHP developers who are Perl-allergic:
Perl is probably easier for a PHP developer to pick up than some statically typed compiled language that typical desktop apps are written in
Perl has libraries to interface to pretty much ANY database back-end you want, though I'm not 100% sure about using Excel as DB directly (I'm fairly confident something exists in CPAN but can't recommend anything from personal experience).
Perl has Windows GUI development - from an easier (for you) web GUI using local/embedded web server to Tk to Win32 GUI modules (StackOverflow has a couple of questions with very good references on the topic of Perl Windows GUI options).
Perl has a fairly complete set of support for MD5/SHA etc... Again CPAN is your friend.
If the only development experience you have is PHP for web, your options for quick desktop development are seriously limited.
since i don't know of any (sane) way to use PHP for desktop apps, my first thought was to reach for a framework that would let you use JavaScript and a mostly declarative UI. That would save you from most of the pain.
The best one for that would be Qt, which is supposed to let you do almost everything on QML and JavaScript. the unfortunate part is the 'almost'; since anything that escapes that would mean C++ development. The best C++ environment, for sure; but still widely different from Web work (specially PHP web work).
The other option, which I think would be best for you is Adobe AIR. I haven't really checked it; but it lets you write a 'desktop-like' app using only Flash (with or without the Flex framework) or HTML+JavaScript. When i first saw it seemed pretty much complete. For DB work i think it can use an embedded SQLite library; or access any HTTP service (which could be a local DB+PHP app exposing the CRUD methods)
You could try PHP-GTK.
It may not be the fastest, but it does work.

Categories