An Emergency Site Move

in programming •  4 years ago 

I created my photo web site back in the Bush administration. The site was running on PHP5. Well, yesterday, my webhost decided to upgrade my site to PHP7 and, guess what? the site is now completely broken.

Site History

servlets.jpg

Domain Tools says I registered the site on 2000-09-25 .

I made a mock up site using PHP3 with the intention of moving to Java Servlets. I could not come up with a servlet structure that had any benefits over the PHP. Since it cost significantly more to run a dedicated server, I gave up on the servlets.

I've come to the opinion that people should not use object-oriented languages for server side programming. Functional programming is both more secure and easier to test.

Back in the day, bandwidth was super expensive and webhosts charged stiff overage fees. A person could lose thousands of dollars if a popular site hotlinked an image.

I had wanted to create a photo sharing site, but felt I couldn't risk exposing myself to overage fees. If a person put an image on my site and started spamming people, then the photo sharing site would both damage my reputation and cost a great deal.

PHP was good enough for the site. Unfortunately, the mysql_query() function of PHP had serious security holes. I eventually solved the problem by encapsulating the mysql_query functions with my own interface.

Here is my problem I face: PHP7 replaced mysql_query() functions with a thing they called PDO (PHP Data Object). PDO is poorly designed.

IMHO, a server side scripting language has one and only one job. It moves data from the database to a web page. The function that moves the data should be as simple and clean as possible. The PDO object fails at that task.

I put off upgrade to PHP7 because I had been thinking about finding an alternative to PHP. I thought seriously about moving to Rust or just writing the site in C. Since my webhost broke my site, I am in crisis mode.

Setting Up a New Server

IMHO, when making a major change to a site, it is always best just to start a new server, and rewrite all of the pages from scratch. Trying to run two types of code on one site just creates security holes.

I will put the new site on a SSH server by php.net running Debian. I will use Apache2, PHP7. I will also switch from using MySQL to using sqlite3. I will use letsencrypt for the SSL certs. As the site is now on a virtual server, I have more capabilities than when it was on a discount web host.

Now for the bad part. I've come to despise PHP after it forced the PDO object on everyone.

OOP was designed for user interfaces. Web pages are delivered by remote servers and are best written in functional programming languages. Trying to force people to use OOP confuses the paradigm.

The Concept Behind ProtoPhoto.com

I designed protophoto.com as part of the Community Color project. My goal was to explore the relations between the objects in our community and the internet. The gallery is full of pictures of local businesses, churches and buildings found in my local community. I was hoping to do a little bit of traveling. In that case I would add galleries for each community I visited.

I am using the site in conjunction with the #gpsphoto tag.

Future Direction

Once the site is upgraded, I will be able to extend it. It would be fun to make a site that could serve images to SteemIt.com, I could make an interface that let other people upload photos.

Conclusion

My site is broken. Fixing it is a drag. I've come to loathe PHP ever since Zend decided to force the PDO object on the programming public. I really need to find something better than PHP.

Authors get paid when people like you upvote their post.
If you enjoyed what you read here, create your account today and start earning FREE STEEM!
Sort Order:  

I don't think it is fair to say that OOP was designed for user interfaces. It was designed for encapsulation, reusability and readability among other things but is in no way meant to be limited to user interfaces. However, it only really succeeds at improving those things if the code base is sufficiently complex. For simple tasks, it's often adds more overhead and complexity than it is worth.

If back end code is complex, OOP is worth it. However, if you are only doing simple things like serving up some photos, it probably isn't.

Case in point, i work for a company who's main product is warehouse management software. It is quite complex and contains millions of lines of code. Relatively recently we updated the user interface from a Java UI to a web based interface. The back end is primarily in C. However, in terms of doing a technology refresh, object oriented C# is far more suitable than javascript (for example) IMHO.