Showing entries 121 to 130 of 921
« 10 Newer Entries | 10 Older Entries »
Displaying posts with tag: PHP (reset)
Poor programming practices

When will it stop. These amateur programmers that simply cut/paste code really affect those good programmers in the ecosystem trying to make a decent living. I was reviewing a developed (but incomplete) PHP/MySQL system using a common framework (which in itself is irrelevant for this post).

In one source file there were 12 repetitions of the following code:

    if (!array_key_exists($id,$this->session->userdata['permissions']) OR
        !array_key_exists('id', $this->session->userdata['permissions'][$id]) OR
        !array_key_exists('scope', $this->session->userdata['permissions'][$id]['name'])){
      $this->session->set_flashdata('alert', 'You are not authorized to go there.');

It’s bad enough when code is repeated and not put in a simple re factored function. When it’s …

[Read more]
Common Lookup Tables 2

Last October I posted an example and description of a common_lookup table. It was intended to show how common_lookup tables support drop down selections in web forms. However, it wasn’t adequate to show how they work with existing data, and the function only supported fresh queries.

This post goes to the next level, and shows how to use foreign keys to preselect values for display in web forms. It also rewrites the prior function so that it supports querying existing data and inserting new data.

Let’s start with data stored in join between two tables – the member and contact tables. The internal lookup uses the customers name from the contact table to find the membership account information in the member table.

1 …
[Read more]
1.5x … 9x faster queries with PHP and MySQL 5.6, really?

I am telling no secret saying MySQL 5.6 GA can be expected to be released soon, very soon. Time to test one of the improvements: MySQL 5.6 speaks SQL and Memcache protocol. In your PHP MySQL apps, try using the Memcache protocol to query MySQL. A key-value SELECT ... FROM ... WHERE pk = <key> can become 1.5x-2x faster, an INSERT INTO table(pk, ...) VALUES (<key> ...) can become 4.5x-9x faster, says the InnoDB team! Read on: background, benchmark, usage, PECL/mysqlnd_memcache, …

[Read more]
Installing Apache2 With PHP5 And MySQL Support On Fedora 18 (LAMP)

Installing Apache2 With PHP5 And MySQL Support On Fedora 18 (LAMP)

LAMP is short for Linux, Apache, MySQL, PHP. This tutorial shows how you can install an Apache2 webserver on a Fedora 18 server with PHP5 support (mod_php) and MySQL support.

Read/Write Splitting with PHP Webinar Questions Followup

Today I gave a presentation on “Read/Write Splitting with PHP” for Percona Webinars.  If you missed it, you can still register to view the recording and my slides.

Thanks to everyone who attended, and especially to folks who asked the great questions.  I answered as many as I could during the session, but here are all the questions with my complete answers:

Q: I wasn’t able to start up the webinar until it was 20 minutes in progress. Is it possible to get a recording once it is over?

A: Yes, we will email a link to all webinar attendees with a recording of the webinar and a link to the slides within 24 hours.  Folks who did not attend the webinar can also visit the webinar …

[Read more]
Installing Nginx With PHP5 (And PHP-FPM) And MySQL Support On Fedora 18

Installing Nginx With PHP5 (And PHP-FPM) And MySQL Support On Fedora 18

Nginx (pronounced "engine x") is a free, open-source, high-performance HTTP server. Nginx is known for its stability, rich feature set, simple configuration, and low resource consumption. This tutorial shows how you can install Nginx on a Fedora 18 server with PHP5 support (through PHP-FPM) and MySQL support.

Webinar on PHP and MySQL Replication

Using MySQL replication gives you an opportunity to scale out read queries. However, MySQL replication is asynchronous; the slave may fall behind.

This Wednesday, January 23 2013, I'll be presenting a free webinar about using MySQL replication on busy PHP web sites.  Register here:

Applications have variable tolerance

Take the Authentic MySQL for Developers Training Course

The authentic MySQL for Developers course will introduce you to tools used by MySQL development professionals and you get the opportunity to work through examples specific to Java and PHP development cases.

In this course you will learn to:

  • Use MySQL tools to connect to databases.
  • Examine database structure and contents.
  • Generate database structure diagrams.
  • Execute complex queries.
  • Manipulate numeric, text, spatial and temporal data.
  • Execute complex subqueries and joins.

You can take this 5 day live-instructor course via these two delivery methods:

  • Live-Virtual Class: Take this class from your own desk by choosing from the many events already on the schedule.
  • In-Class: Travel to a training center to take …
[Read more]
Solution for: MySQL 5.6 password expired, PHP can’t connect, application stops

MySQL 5.6 introduces a new features that must be used with great care. A MySQL users password can be marked as expired. This way, a DBA can force a user to set or reset his password. The MySQL user must set a (new) password before he is allowed to do anything else. As a consequence, if a users password is expired all standard PHP MySQL API connect calls will fail. Applications stop working unless the application is changed to include a user dialog for setting a new password. To develop such a dialog for resetting an expired password one has to use a new connection flag introduced in PHP 5.4.12-dev. Don’t panic: to get in trouble DBA actions have to be at one level with dropping the MySQL user of a production PHP application…

Relax: IF MySQL 5.6 AND IF …AND IF …

You are being warned in time about a pitfall that DBAs may tap into in the …

[Read more]
PECL/mysqlnd_ms and the client failover dilemma – part 1

MySQL Replication has a weak point: the master (primary) is a single point of failure. People ask frequently about client failover. Making a client library failover a client automatically from one server to another is simple. PECL/mysqlnd_ms can do it. Unfortunately, this is only the tip of the iceberg when using a primary copy (master-slave) database cluster. Among others, you may have to reconfigure clients. Below is one hint (no solution) for deploying PECL/mysqlnd_ms configuration files using MHA (Master High Availability Manager and tools for MySQL).

What’s the plural of dilemma?

If a server is unavailable a client may attempt to connect to another server given a list of alternatives. A client library can handle it entirely transparently and automatically if connection state is no …

[Read more]
Showing entries 121 to 130 of 921
« 10 Newer Entries | 10 Older Entries »