php5

Caller function in PHP 5?

Is there a PHP function to find out the name of the caller function in a given function? ...

How do I iterate through DOM elements in PHP?

I have an XML file loaded into a DOM document, I wish to iterate through all 'foo' tags, getting values from every tag below it. I know I can get values via $element = $dom->getElementsByTagName('foo')->item(0); foreach($element->childNodes as $node){ $data[$node->nodeName] = $node->nodeValue; } However, what I'm trying to do, i...

exporting mysql data to ODF with php

Hello, I would like to know if someone triend exporting data from MySQL to an ODF format ? Any information / documentation would be very much appreciated. I am going to try to export a MySQL result set to ODF spreadsheet if possible. ...

Resolve a filename from another file

I can currently to the following: class SubClass extends SuperClass { function __construct() { parent::__construct(); } } class SuperClass { function __construct() { // this echoes "I'm SubClass and I'm extending SuperClass" echo 'I\'m '.get_class($this).' and I\'m extending '.__CLASS__; } } I would like to do som...

How can I use both PHP 4 and 5 with the same apache install?

I am trying to make this feature available, maybe in an apache .htaccess file. ...

Odd permissions on file modified by PHP move_uploaded_file()

I'm running PHP 5.2.6 on a Windows Server 2003 Enterprise box. IIS is set to deny anonymous access and use Integrated Windows authentication. I'm using a PHP script to save a file uploaded from a web form. The file is uploaded to a temp folder, the script creates a file name and path depending on other variables from the web form, and ...

Avoiding SQL injection in a user-generated SQL-regex

Hi. I'm creating a site where the user unfortunately has to provide a regex to be used in a MySQL WHERE clause. And of course I have to validate the user input to prevent SQL injection. The site is made in PHP, and I use the following regex to check my regex: /^([^\\\\\']|\\\.)*$/ This is double-escaped because of PHP's way of handling...

Ideal PHP Session Size?

Hi, I have a PHP form (mortgage app) that is about 400 fields, traffic on the site will be low. What is the ideal Session size for 400 fields going into a MySQL db? In PHP.ini what do I set? Anything I should set that I am missing? -Jason ...

create .CSV File for user in PHP

Hi, I have data in MySQL. I am sending the user a URL to get their data out as a CSV. I have the e-mailing of the link, mysql query, etc covered. How can I, When they click the link, have a pop-up to download a CVS with the record from MYSQL? I have all the info to get the record already I just dont see how to have PHP create the CSV ...

PHP mkdir question

Hi All, I am doing: mkdir("/people/jason", 0700, TRUE); TRUE = Recursive in PHP 5 and the server is running 5.2.5 but I get: Warning: mkdir() expects at most 2 parameters, 3 given in /home/net1003/public_html/admin/_createPage.inc on line 5 ...

__construct() vs SameAsClassName() for constructor in PHP

Is there any advantage to using __construct() instead of the class's name for a constructor in PHP? example: class Foo { function __construct(){ //do stuff } } OR class Foo { function Foo(){ //do stuff } } ...

mod_php5 uses temporary files for parsing?

I've noticed that most of my more annoying errors generate parse errors similar to this one in my logs: PHP Parse error: syntax error, unexpected T_FUNCTION in d:\docume~1\***\locals~1\temp\tmpwvpo4p on line 5. This is annoying to say the least, because I have not a clue what exactly that is supposed to be, and like a good program, ...

Setting up a PHP web project, the infrastructure.

Hello, How can I best set up my PHP (LAMP) development environment so that I have development, staging and production servers. One-"click" deployment to any of those, as well as one-click rollback to any revision. Rollback should also rollback the database schema and data to how it was when that source code was current. Right now I'v...

__destruct visibility for PHP

Should the "visibility" for the __destruct function be public or something else? I'm trying to write a standards doc for my group and this question came up. ...

Strategies for handling memory consumption in PHP5 ?

We have a large management software that is producing big reports of all kinds, based on numerous loops, with database retrievals, objects creations (many), and so on. On PHP4 it could run happily with a memory limit of 64 MB - now we have moved it on a new server and with the same database - same code, the same reports won't come up wi...

PHP w/ Zend Debugger on OS X 10.5

I have OS X 10.5 set up with the precompiled versions of PHP 5 and Apache 2. I'm trying to set up the Zend Debugger, but with no luck. Here's what I did: I downloaded ZendDebugger-5.2.14-darwin8.6-uni.tar I created the directory /Developer/Extras/PHP and set the permissions to: Permissions: drwxrwxr-x Owner: root:admin I copied Zen...

Best practices for managing several specialized versions of one app

I have a web application that has many faces and so far I've implemented this through creating themes. A theme is a set of html, css and images to be used with the common back end. Things are laid out like so: code/ themes/theme1 themes/theme2 And each instance of the web application has a configuration file that states which theme ...

Removing repeated conditions using polymorphism and the Factory pattern

<?php /** * My codebase is littered with the same conditionals over and over * again. I'm trying to refactor using inheritance and the Factory * pattern and I've had some success but I'm now stuck. * * I'm stuck because I want to derive a new class from the one * returned by the Factory. But I can't do that, so I'm obviously * d...

What the best way to access the databse inside a class in PHP?

I have a session class that needs to store session information in a MySQL database. Obviously I will need to query the database in the methods of this class. In general I may need to connect more than one database simultaneously and may or may not be connected to that database already. Given that, what's the best way to access datab...

Installing PHP 5 on RedHat Enterprise Linux 4

I'm tearing my hair out trying to get PHP 5.2.6 installed on our RHEL 4 box here. Upgrading to RHEL 5 is an option down the road, but not tonight, which is when we need to get this instance of our webapp that depends on a new build of PHP running. Any advice in this vein is much appreciated! I've been working through suggestions made ...