A lot of my past software development background has been around client/server in financial markets, with the main RDBMS use in Sybase, but also MS SQL Server and Oracle. In most cases stored procedures is the way to query and manipulate the database. There are a number of reasons for this including security, performance and centralised business logic out of the client.
Now in recent years I have made the move to web development in PHP, and in most cases using MySQL as the database server. From personal experience of others code, and available FOSS systems, it is extremely rare to see use of MySQL stored procedures behind web sites. They are there, have been for a number of years, and do work. So why is this so?
The first reason I could understand, was that they are a MySQL 5 feature, and most FOSS apps set their MySQL minimum requirements at version 4.x.
I now understand a 2nd and crucial reason, thanks to a post by Jay Pipes. MySQL stored procedures are not the same as Sybase or MS SQL. The shared compilation performance benefit is not there in MySQL 5.0/1 for non persistent or pooled connections. ie. most smaller to medium web sites. Their usage may actually be to the detriment of performance.
So stored procedures can have a use in MySQL, but mostly in limited use cases.
Tag Archives: php
Nginx and PHP environment directive
With the Apache web server, I set a server wide directive of which environment the server is in, eg. production, test or dev, using the SetEnv directive. In a PHP script I can pick up this value, and set on all debugging in dev, or suppression in production. Having it set 1 place in Apache means I don’t need to hard code the environment in any PHP code, making movement of code between environments cleaner.
Recently I have begun to use Nginx as the web server with PHP fastcgi for a project, and was looking for a similar set up. The answer I have come up with is an additional entry in my fastcgi_params file. The exact name & location of this file may be different for you. Mine is located at /etc/nginx/fastcgi_params.
fastcgi_param SYS_ENV dev;
This way in my bootstrap script I can have the following code:
if ($_SERVER['SYS_ENV'] === 'production') {
date_default_timezone_set('America/Los_Angeles');
} else { // Test and dev
error_reporting(E_ALL|E_STRICT);
date_default_timezone_set('Australia/Sydney');
ini_set('display_errors','On');
}
There is probably another way to do this with Nginx, and I would be happy to hear it, as I try and improve my Nginx knowledge.
Is an open license enough?
Does having an open license for a software project, have all the advantages negated if the development process is basically closed to the outside world?
Recently I have been trialling a new web based account/billing software. It is not a very mature project, but the features listed and performance so far have me believing that this is potentially a good solution. Also it is written in a language I am comfortable with (PHP), and it has an open license (GNU AGPL). Hence I may be able to contribute.
However, I have now encountered some issues. The project is under the control of a small company, and project communication is limited to a couple of mailing lists. I have tried direct communication, but the response was things are proceeding, and they are very busy.
The latest planned release date has now slipped twice. I understand software development, and this happens, but public communication has been minimal. Also there is no public source control. In most FOSS projects, a browse of commits will give a good indication of the health of the project, but this is not possible.
So we have a closed open source project. Some may raise the option of forking, but this is almost exclusively a bad result in the long run. So I will wait a little longer, and see how it goes?
Note: I have intentionally not named the software in question, as I still have hope for this project, and do not wish to tarnish the reputation unfairly.
5 Free Software PHP Issue Trackers
If you are using version control in your development, your team or self is most likely wanting to use an issue or bug tracker for your development. There are alternatives to a dedicated product like whiteboards, spreadsheets, email folders or a super memory. However for this article we will compare dedicated issue trackers, and to be more specific, 5 PHP based trackers that are released as free and open source software.
All evaluation was done using PHP5.2.6 on Apache 2.2.9, MySQL 5.0.67.
Continue reading
The Big List of PHP Frameworks
For the start of a new year, it was time to clean out the list of PHP frameworks. A few have fallen by the wayside, but many new ones have been added. It seems that patterns and MVC is still all the rage, but less are professing to being Rails clones, though the inspiration of convention is still strong. There are a wide variety of framework types. From full stack (cakePHP, Symfony) to components (eZ), a bit of both (Zend) and minimalist (LightVC, TinyMVC, Pluf).
Continue reading
PHP developer blogs to read
The internet is full of good and bad content, not just when it comes to PHP. Here is a list of the PHP related blogs that I consider most interesting.
Continue reading
Introduction to PHP with Xdebug
This article is an introduction to some of the ways Xdebug can help you with your PHP code. Xdebug is a stable and mature PHP extension that can be invaluable in debugging and profiling your PHP code.
Continue reading
Searching FOSS project management software
I have begun the search for a software application to manage project tracking and collaboration. It will need to be browser based so I can have it used internally and externally for Aura Media. Using PHP as the scripting language is the preference as that is what I am most comfortable with, but I am not against a solution that used Python or Ruby. The last requirement is a free and open source license.
In the past I have been a happy Mantis user for bug and issue tracking. So much that I have installed it in a few client sites. However now I want a broader product that includes time tracking and more collaboration features. Also Mantis is showing its age in a visual sense, and this can put off less technical users. Project tracking is the aim, not project planning with features like gannt charts.
In the past I did look at ActiveCollab, but they changed their license, and Streber, but it was immature and moving in a more wiki direction.
My current investigation list is:
- ProjectPier (activecollab fork)
- the terribly named OpenGoo (another activecollab fork)
- Redmine (RoR based)
Open to any other suggestions.
XSS and SQL Injection PHP Code Scanner
From XSS News comes a link to an application called Pixy. It is a java app that takes PHP code and warns of potential cross site scripting and/or SQL injection vulnerabilities.
There is plenty of documentation, with good explanations of what Pixy can and cannot achieve. For example you cannoy throw it a directory of code, and have it find problems. If your PHP code has multiple entry points, then it needs to be run once for each of these.
A web version is available to do XSS test on single pieces of PHP code. There is a requirement to have Perl installed on your system for the download version.
Does every php developer have their own framework?
I have tried a few php frameworks over the years, sometimes with a positive experience, sometimes not. But the sheer number of them still amazes me. I had an original list of 22 for this site, and when we upgraded a few were culled off as they seemed to be dormant. However on a regular basis I am contacted about a framework that I didn’t know existed, or come across it by chance. Also a number seem to have stopped development.