PHP is a server-side scripting language designed for web development and a very popular one. It powers many of the popular websites that had became part and parcel of our lives.
In this page, you can find articles on PHP references, PHP coding and application setup.
I was trying to start a new WordPress site. Before hosting it on a Digital Ocean droplet, I decided to incubate the WordPress site on a Raspberry Pi 3 to clock some content. This post documents the steps that I took to set up a LEMP web server on Raspberry Pi 3 with an Ubuntu server 15.10.3 image to host a new WordPress site.
I was trying to setup a WordPress instance with the built-in PHP-FPM server on my Mac OS X el Capitan. After applying the relevant Nginx configurations for WordPress installations, I had been able to run the php codes from my WordPress instance.
However, when I tried to run the WordPress install script, my WordPress setup complained that it was unable to connect to the database server.
When I had that spark of motivation to build a website for myself, I do not know how to get started.
At that point of time, I found myself lacking in the following skills to:
design my website
create codes for the browser to render the front end look and feel
create codes for the web server to respond to HTTP requests from the browser
write some decent content for my website
This post lists the books that help me understood the concepts that I needed and acquired the skills that I needed to fulfill my motivation of building my website.
There are times when we want to push a dynamically generated file to our users based on their inputs. That file could be an excel file that holds payment transaction reports for a time period or a tabulation of guest names who had accepted invitations to our corporate house warming.
In such cases, the user should be presented with a dialog box which lets him decide whether to save it somewhere in her local filesystem or open the file for viewing with an appropriate application in his computer.
For example, in my tool for generating boilerplate coding from a list of country names, I am presented with some input fields where I can submit some instructions to format the output of the boilerplate coding. And upon clicking on the “Generate” button, I am shown a dialog box that looks like the following:
Let’s cook up a simple scenario to demonstrate this idea with jQuery.
Suppose we are creating a simple game for the user to draw a random number. For this, we have a text field for the user to write his name. There will be a number dial that changes at random. When the user clicks on the “Get lucky number” button, the browser will present a text file for the user to download.
The text file will contain the user’s name and the number taken from the number dial at the instance when he clicks on the button.
I realised that there was something missing in my WordPress blog; a page that lists all the posts that I had written so far. This post documents what I had explored to give my blog a page that lists all my posts, starting from the most recent post down to the oldest post, and groups them by month and year.
To minimize overhead costs of my website, I would restrain myself from buying a hosted plan until my website is launch-able. In the process of developing my website, I will want my tests to be as close to the real thing as possible.
This meant that when I type in the real domain of my website in my browser location bar, my browser will connect to my development web server, instead of the web server which my domain is being parked at.
I was using Windows 7 and an instance of Apache HTTP server as my development environment when I achieved that. My Apache HTTP server was listening at port 80 for HTTP requests.
There are two main steps to achieving my objective:
Routing HTTP requests, made to the actual domain, to my local machine
Configuring Apache HTTP server to serve HTTP requests directed at the actual domain
We have a MongoDB server running as a windows service on the same machine as our web server. Over time, this MongoDB server had been listening on port 33333 to help us remember information that we had collected about our friends.
As time passes, our memory can hardly rival that of our MongoDB server, which was designed to help us recollect information efficiently. This post documents some proof of concept that I did for querying documents from MongoDB collection via the PHP driver.
We met a new friend, and we want to save some details about her. That night, before bidding farewell, she said: “Remember me, I am Mary Jane. You can write to me at mary.jane@gmail.com“.
Although that’s all we have about her, this is sufficient for us to insert a document about Mary into our MongoDB database.
Inserting documents into collections in MongoDB with PHP consists of the following steps:
Derive an instance of the MongoCollection class that represents the MongoDB collection to insert documents.
Define the document to insert.
Define additional options for the insert.
Execute the insert function of the MongoCollection instance.
Follow us