I have a beginner's question which might have been answered earlier but I am sure technology has changed.
I have a PHP/MySQL based web application running on a hosted environment and I want to migrate it to Google cloud SQL.
Over the period, it has built into a good enough relational database schema and historic data.
The question is is it possible to use this existing data schema and
the data by uploading it on google cloud sql environment? If yes then how
and a sample would be appreciated.
will there be any extensive change to the existing php and mysql code?
Regards,
Jack
I'm fairly sure that Google Cloud SQL doesn't actually support PHP scripts! I'm in a similar position to you, currently we're running on a MySQL/PHP server, I've explored various options such as Google, Parse, StackMob etc and ultimately decided against it for a few reasons.
If I were to start making a new product again, I'd definitely look into cloud storage in a lot more depth, it would have saved a lot of headache setting up my own backend and making sure it was robust, secure etc. However, now that I have made my own back-end that runs very well and has been properly 'field tested', I'm reluctant to just move to the cloud for the sake of it.
The cloud is the new technology everyone is heading to, and I agree it probably is the right direction, but the advantages it offers (imo) aren't so great for most existing products, especially ones with complex logic. PHP/MySQL can stil do its job very well in the right hands.
Thats just my thoughts anyway - I've tried and failed to find a trustworthy cloud provider that supports PHP (mainly seems to be JS/Python) as this would make it a lot more attractive to me.
If it's scalability you're after, you can rent Cloud server space (even as a VPS) from 'traditional' hosting companies. You run them in much the same way through cPanel, PHPMyAdmin etc, but behind the scenes they are distributed across a worldwide network rather than just residing on one machine, giving them many of the advantages of cloud solutions such as better handling of traffic surges, scalability etc.
I am NOT an expert in all this by any means, just talking by my own experience from researching this the last few weeks. You may get a better answer from soneone else!
Related
I wanted to know if its possible to host just plain old simple PHP scripts on google app engine. This scripts will just be bridge/api between MySQL(planning to use cloud SQL) and android application.
If its possible than i would like to know if is it worth it? How its better than hosting scripts on regular web host? And can anyone please point me to right direction where i can find some useful tutorials? If not which alternatives should i look into?
I did some research and found some resources but they where talking about php application with app engine. I just want to know specifics about php scripts as an api and app engine.
Thank you!
You ask:
I wanted to know if its possible to host just plain old simple PHP
scripts on google app engine. This scripts will just be bridge/api
between MySQL(planning to use cloud SQL) and android application.
Sure! Unless you're doing very fancy stuff and running afoul of the "sandbox" limitations explained at https://cloud.google.com/appengine/docs/php/#PHP_The_sandbox, your PHP should run fine on App Engine.
If its possible than i would like to know if is it worth it? How its
better than hosting scripts on regular web host?
If you don't plan to take any advantage of the differences of App Engine and Cloud SQL -- you're adamant to use them just as if they were "regular web [[and MySQL]] hosts", with zero interest in actually taking any of the advantages -- there may still be wins, but, only in somewhat unlikely circumstances.
For example, you might respond to a sudden spike of traffic much better with app engine's autoscaling -- but if your attitude to serving your customers is that you can't be bothered to do a tiny amount of effort to customize your code to your actual hosting platform, then I'm not creative enough to figure up a scenario in which you would get a burst of traffic; rather I would expect your more sensible competitors, happy to spend a couple hours learning and another couple hours adapting their code and config, to eat your lunch (and breakfast and dinner -- elevenses too, probably) and take away your customers so you'll never have to worry about traffic bursts and scaling up to larger volumes, as your volumes, I would guess, will not get any larger... on the contrary.
As Jerry Pournelle would put it (and did, in "Oath of Fealty" -- by far not his best work otherwise) -- "think of it as evolution in action".
Ah well, I already loved Jerry as a writer 12 years ago -- then, see http://code.activestate.com/lists/python-list/335605/ , in his column on "Byte" (a magazine I also long loved, and never failed to devour cover to cover, every month! for ages), he splurged love upon Python... and specifically upon my own book, "Python in a Nutshell".
I didn't make any substantial amount of money directly out of the book, but (together with the Python Cookbook) it did help ease me into many great consultant contracts, and later led me to the Google job I still have and enthuse about. (not to mention my marriage -- http://www.aleax.it/marall1.pdf !-).
So I'm biased and can't stop loving Jerry -- and his "evolution in action" is part of the package...!-)
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
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.
We have a custom software project that's database driven (MySQL) and is built with php and some public and custom libraries.
It's currently being hosted on a VPS, and being the intern, I've been assigned the task of researching how we can transition it so it can be hosted in a cloud.
My research so far has led me to providers such as Amazon EC2, but they don't say much about the software side of things. Some of the literature suggests that it's not a simple matter of just moving the software to the cloud. It looks like modifications to the software need to be made. I'm not sure like what (do I need wrappers around it, or something like that)? I need some clues to get started in the right direction.
I'm planning to pick up a book on this topic, but I'm interested in hearing from others what standard changes we're likely to need to make for this use case.
This sounds like another case of the business heres a new tech word and says well why are we not doing that? This boils down to what do you want to benefit out of moving to the cloud? What type of application is this? Being you mention php and mysql I am assuming this is possibly your companies web application or intranet of some sort. The benefits of the cloud lie in scalability and computing resources provided on demand with additional abilities for redundancy in your data store.
Long story short though, with a web application you will not be much concerned with any of this when moving to the cloud as your scripts will run on your instance in the cloud and the cloud will handle resource allocation and what not.
"cloud" is a fancy word for VPS with some extra features like performance scaling without reboots and seamless migration from one hardware box to another. If your application works fine on VPS, I would not envision you will need to change anything.
The providers don't say much about the software side of the things, because from such a high-level environment like PHP and MySQL it makes no difference if you run it in VPS, bare iron or the cloud.
The only issue you may have is MySQL performance, but again, if you were fine with VPS you will be fine with the cloud.
Unless your software is very poorly written, there should be no concern about whether it runs on a VPS or in the cloud. In fact, your software likely wouldn't know the difference.
I've been assigned the task of researching how we can transition it so it can be hosted in a cloud.
You've jumped straight into questions about transitioning of software, which won't be an issue. Your boss may actually be more interested in finding out if a move to EC2 will impact: security (maybe), processes (maybe) and admin access to the box (maybe). It's hard to answer these questions, because they're usually dependent on your corporate policies.
I am developing a big application using PHP. Is MySQL or SQL Server the best one to use?
Neither. Use PostgreSQL. :)
Honestly though, PostgreSQL scales much better than MySQL. I don't know what you mean by "enterprise", but I figure scaling is important for a "big" web application, as you put it, and PostgreSQL does that very well. MySQL can't handle too many concurrent connections. (Though if that isn't an issue for you, go with MySQL for ease of use.)
MySQL and PHP work well together. I'd recommend that combination.
I'd much rather choose an open-source solution rather than rely on MS. That said, you can go with PostgreSQL as well if you need to, or your requirements gear you toward it. We would need more details to know what you truly require.
While this is a bit subjective, I would suggest going with MySQL.
The reason I say this is because traditionally you see people go with a LAMP setup. LAMP of course being Linux + Apache + MySQL + PHP
PHP has some great build in functionality for dealing with MySQL Databases, therefore it may be easier for you. Then you'll also have the ability to do some web based work with PhpMyAdmin tying a web interface to your Database
Use the one you and your team has most experience in terms of both development and administration.
If you start from scratch, I would go with PostgreSQL.
Between your choices I would go for SQL Server, especially if you are working in Windows environment.
It will depend on your application's needs. I'm not especially well researched on the differences between the various SQL engines, but as far as I know, MySQL is faster for SELECT queries (if you have a predominantly read-only type app). On the other hand, MSSQL and PostgreSQL both have better support for transactions, and perhaps also better performance if you have lots of inserts/updates happening. Also, MSSQL and PostgreSQL are said to scale better, but there are various successful applications that seem to do fine with MySQL (Facebook and Flickr as examples).
MySQL and SQL Server Express are free for production use. In my view the best advice is to try them both and decide for yourself. A lot of folks can live quite happily with a lightweight RDBMS where solutions like MySQL/Express may be appropriate.
From a purely technical point of view all of the major RDBMS vendors (Oracle, Sybase, DB2, SQL Server et al.) are significantly more capable than MySQL is currently or can reasonably be expected to be in the foreseeable future.
This does not mean you should not use MySQL for a particular job. A good analogy is continuing to use a version of Microsoft office released years ago. For most people the old version does everything they would ever want even though the newer version is "better" and has more features.
MySQL is certainly better to work with PHP. But MS is putting a huge effort in better supporting PHP on Windows platforms.
SQL Server is DEFINITELY the better choice for large enterprise solutions since there's better cluster and management support. We use MySQL for cost reasons, but i would really like some easier management and cluster support.
On the other hand it's like with computers: many features you need to compare if they suit your needs - and your purse.
If you are doing a one-man-show: Step away from SQL Server. It is only suitable for enterprises. Take MySQL or PostgreSQL.
For most IT directors a big decision is going to be which can you get the best support for in your area / online / already have in-house and which can you get the most uptime for. Ongoing costs are usually higher than deployment costs so its probably not worth worrying about license costs; unless you are into ia64 or better type systems anyway when the CPU count starts to make SQL look eye-wateringly expensive.
It's like deciding what computer to get, they are by now pretty much the same no matter what brand you pick. It's pretty much the same for databases, they all support most of the things that you need for lightweight webapplications.
I have used MySQL to all my php applications so far and had no problems whatsoever. I have wanted to test out PostgreSQL several times but never got to it, but I have heard very good things about it. I never touch MS products however, so no opinion (Not that I am allergic, I'm just stingy.).