Mark Foster's Blog

Misadventures in Technology

Entries for the ‘PHP’ Category

PHP/Apache running on Linux won’t connect to a PostgreSQL server

SELinux will block PHP/Apache from connecting to PostgreSQL (and probably any other DB) by default on some Linux distributions. If you are trying to get PHP to connect to a PostreSQL DB on a linux box for the first time and you are sure your pg_hba.conf on the target box is setup correctly then try [...]

Php-cgi.exe application error on IIS with FastCGI

I recently installed PHP 5.2.14 on a Windows 2003 machine running IIS 6 with FastCGI to do some PHP testing at home. I chose the fast CGI install and added several extensions during the install including Curl and Oracle. When I attempted pull a test page after the install completed, I saw the following php-cgi.exe [...]

How to get the contents of an Oracle CLOB data field in PHP

The Oracle “CLOB” (Character Large Object) is a data type used to store up to 4 Gigabytes of text. Retrieving the contents of a CLOB is not as intuitive as you might think. Let’s say you have a CLOB field/column named “mychars” in an Oracle DB table named “mytable” along with some other fields. You [...]

How to use the PHP cURL module to make HTTP requests from PHP

Some of my previous posts talked about making HTTP/web requests from PHP with a focus on the PECL_HTTP request module: How to use the PECL HTTP (PECL_HTTP) Extension to make HTTP requests from PHP How to: PECL HTTP request exception and error handling PHP HttpRequest class options and notes How to use the file_get_contents() function [...]

How to setup and use the Xdebug Extension for PHP Profiling

A profiling tool can provide valuable information about bottlenecks in your code. I believe profiling is a critical aspect of optimizing because it will tell you about your real code bottlenecks as opposed to your perceived bottlenecks. This enables you to focus your resources on areas that will provide the most performance benefit for your [...]