PHP and MySQL are core pieces of software primarily used for web development. They are often paired with Linux and Apache resulting in a configuration called LAMP (Linux Apache MySQL PHP).
PHP and MySQL are not only solid, but open-source which is easy on developers, and they are relatively simple which is wonderful for developers.
PHP is a double-redundant acronym, standing for Personal Home Page Hypertext Processor
Keeping PHP Sessions open, or any sessions open regardless of what language you use, can be a pain. One of the most commonly asked questions is “How do I keep my sessions open for 30 days or more?”.
This is written from the perspective of PHP, but of course Cookies themselves can be manipulated from whatever server-side language you use to code your web application.
So if your users only stay logged in for a few hours, maybe a a couple of days at the most, and you want them to stay logged in much longer, continue reading.
The main reason this method works is because it doesn’t rely on PHP to keep the session, and sessions on the server tend to get cleared out, which is probably the most common reason for users having to login again. Rather than rely on PHP garbage collection to work properly, you take control of a secondary session that you store yourself. When the primary login check fails (depends on your application), you check the secondary session against your own records, and if you find a match, you can auto-login the user, returning control to the PHP session itself. You can choose to be seamless about the whole process, or you can present your user with one of those unnecessary messages saying “Please wait while we find your account…”. (more…)
If you are using jQuery, and you’ve noticed some errors appearing in Firefox, it might be a very simple fix.
The errors resemble the following:
- “not well-formed” (maybe referring to a specific piece of returned HTML)
- “mismatched tag. expected </input>” (or “expected </option>”, “expected </td>”, “expected </br>” etc)
Chances are you are using jQuery’s load() or get() or ajax() functions and sending a response back to jQuery via PHP or another server-side langauge. (more…)
Types of PHP Frameworks
Frameworks existing for many purposes and are written in many languages. PHP frameworks come in many shapes and sizes, so it’s important to match your requirements and your development capabilities with the framework.
If you are very picky, you’ll need a framework that easy to customize. If you don’t have any development resources, you’ll need to choose a framework that provides all the functionality you will need.
Frameworks can be “large” or “small”, “light” or “heavy” and everywhere in between. For example, Joomla and Drupal are “large” and “heavy”. They contain lots and lots of code, lots and lots of built-in logic, and accordingly have lots and lots of problems. On the other hand, frameworks such as CodeIgniter are “small” and “lightweight”. CodeIgniter is minimalistic, and some would consider it more of a code organization tool. WordPress isn’t strictly a framework, but works great as a framework and isn’t as “small” or “lightweight” as CodeIgniter, but it isn’t “heavy” either. (more…)
Finding analogies for programming is very important for training programmers, for communicating to other programmers, to communication to customers and end-users, and to help a programmer’s understanding of their own code and goals for their code.
One thing to remember about analogies: They always brake down. An analogy is a “comparison” – and all comparisons will fall apart eventually, unless the things being compared are identical. In other words, at some point the comparison falls apart because the two subjects are different. This is okay, because we are just using this “comparison” mechanism for learning and understanding, we are not using this comparison to make the plans for the next space shuttle.
Example: A car needs new wiper blades, brake pads, and tires. And just the same, a web application or other application needs some basic maintenance.
PHP exec() command is heavily used, but sometimes when using mysqldump and other commands the results can be confusing and difficult to debug.
Namely, when tables are crashed, exec()’s $retVal might end up as either 2 or 3, and the table may or may not show as Crashed when doing a “SHOW TABLE STATUS”. Try to do a mysqldump, and look at the very end of the file to check for an error. Alternatively, just attempt to REPAIR TABLE on the table after the last table it successfully backed up.
It is best to always treat any value in $retVal as an error.
Apache is massively popular right now and probably the leading web server software. As such it is a security target, and much development and updates happen regarding Apache security. .htaccess is a security method long used by Apache, although it can do much more than just security. The .htaccess file provides a lot of functionality, anything from redirects, to URL re-writing, to changing PHP settings or Apache settings, folder display settings, and password and IP security.
.htaccess is hugely popular and a great way of going about several important tasks on a website. Documentation is readily available on the internet, most features are very easy, and the features it provides are incredibly useful.
A queue, in our context, is a way of lining up requests, and having a program that processes those. Basically, it’s a way of saying “do this later”. It might still be done immediately, but for a variety of reasons it may not happen immediately. The purpose of the queue may not to be “do it later”, but that will happen regardless. The purpose of a queue can be anything from fixing a performance problem, to preventing performance spikes, to delaying a request a minimum amount of time or a number of other reasons. (more…)
Crons can solve a lot of problems, but they can also create a lot of problems so be careful.
Usually you’ll make a cron to fix a specific problem, or to create a queue. There aren’t a whole lot of “standard” crons that we can discuss. (more…)
It’s a wonderful thing. Queues are a great way to deal with performance issues. Generally, from an end-user perspective they make the system appear to work very quickly.
This is #2 in our series because if you are searching for information on performance fixes, chance’s are you need a quick fix of some type. Queues are a great quick fix, they are also suitable for long-term implementation, and can solve a variety of problems, however they are only useful in certain situations so don’t get overzealous. (more…)