Categories
How-To Web Design

Installing Google Firestore for PHP

Using the NoSQL database Firestore with PHP means you need to install a few tools to make it work. The alternative is to use the JavaScript option but when the Firestore access is put into the more secure mode then the backend option with PHP may be needed.

The Google docs point to installing the gRPC library for PHP via two options, either PECL or with Composer. But as with many technical docs, seem to miss a step or two that leaves the reader a little lost and probably frustrated. Hence I’ll step through what I did here with PECL for Ubuntu 18.04 in WSL on Windows 10. (BTW – I thorough recommend Windows Subsystem for Linux in Windows 10 for web development; it’s a good middle ground of dev tools and productivity experience. Grab the new Windows Terminal app to get that easy terminal access to the WSL instance too.)

First, go and have a read through the docs from Google linked above. It’ll give you the view of what needs doing, and hey, maybe it will work for your environment. Otherwise I’ll describe the steps below that I needed to go through.

NOTE – Where you see a PHP version in a command, make sure you use your current version to get the right framework version.

sudo apt-get update
sudo apt install php7.2-dev autoconf libz-dev php-pear
sudo pecl install grpc

The PECL install step will likely take a few minutes while it goes back to basics and compiles the gRPC module. Lots of information will scroll up the terminal window.

After PECL has completed and successfully created the grpc.so, you’ll need to follow the instructions in the PECL output and update the php.ini config to ensure the module will be loaded.

After you have edited your php.ini file, reload your web server to ensure new processes are loaded. Use of Apache is assumed with the commands below.

sudo nano /etc/php/7.2/apache2/php.ini
sudo service apache2 restart

Now you should have everything compiled and loaded as expected. If you have a test file that’ll dump out your PHP config, load that and search for “grpc”. If you don’t have a file that’ll do that, I’d suggest you create one in a dev environment to help out with the server config. All you need is the following line in a PHP script file in your web server directory.

<?php
echo phpinfo();
?>

Loading that file in your browser should then show us that config section we’re after.

We’re done! Hopefully that worked for you or at least provided some useful information.

Categories
Code Web Apps Web Design

Doc5 Beta Now in Testing

After many years I have got a version of Doc5 up and available to use. It’s a vastly different wiki app than the previous version and most of the changes have been made in the last 9 months. The last version released for download was a different name and appeared before my son was born. He starts school in two weeks.

My 9-5 job takes up enough time that for a couple of years I left this project¬†alone and considered dropping any¬†thoughts of pushing it out. But writing web apps is my hobby, so it’s been good to dig through all the old code and clean it up.

So a list of the major changes:

  • WYSIWYG editing has arrived and the previous wiki engine is gone
  • Permissions have been simplified but also extended to categories
  • Full UI make over, although I have gone with a pretty basic Bootstrap view of things.
  • Better file uploads and management.
  • Templates for email notifications

I think a full release should be available for download in the next two months. Testing on the web will help tune spam catching and there’s some bug fixing to roll out as well as plenty of test cases to run.

Categories
Web Design

All the Web2.0 You Can Handle

Read/Write Web has a list of . . . lists. All containing information about Web2.0 sites springing up like daisies around the internet.

What’s a Web2.0 site you ask? It’s one of those good-looking, fancy acting websites you’ve probably seen around. The developer of these sites use more acronyms than before, like AJAX, JSON, etc that allow users to interact in ways they couldn’t a couple of years ago. Some of these sites are so cool they drop vowels from their names – Flickr and HappyCodr are a couple of examples.

Overall they still need content and community but some of them are just beautiful to look at and fun to play with.

Categories
Code Web Design

Why Aren’t You Using FireBug?

I’ve been using the Firefox browser addon called FireBug for a while now and am amazed at how helpful it is. If you’re a web developer, and especially if you use JavaScript and AJAX methods, you should be using it.

For example, while developing I like to add in timers to PHP based pages to show how long things are taking. This way if a SQL statement needs some fine-tuning or a change slows things down I can see it happen. FireBug extends this to the entire page and the HTTP traffic. Here’s what happens when I load a page that has a few JavaScript calls, small images and a single CSS link in it,

Straight away it’s obvious what’s taking up the bulk of the time – those two library calls. Once I take those out of the equation the load time drops to under a second. And through all this the PHP timer function only shows me how long the server-side work is taking.

With FireBug I know who (in a geeky code way) is doing what and with who and I can act on it. Now that’s helpful.

Categories
Web Design

Securing Apache

Twenty ways to make sure that the 10 year old script kiddie down the street does not mess with your Apache Web Server.

Peter Freitag – 20 ways to Secure your Apache Configuration

Categories
Web Design

The Big Book of CSS Tabs and Navigation

Well OK it’s not a book but have a look at Vitaly Friedman’s CSS Showcase for a whole lot of CSS navigation examples and how to do it right.

Personally I’m a fan of the the usability compliant Mozilla entry and Veerle’s for sheer beauty.

veerle.duoh.com