php5

$_GET access inside __constructor() for PHP5

I am trying to populate a private data member inside a class via a $_GET parameter? Is this possible, or too complex for the constructor to handle? SOLVED *** - __construct was incorrectly typed /myfile.php?pid=f3f3rs2 class getvalue{ private $pid; function __constructor(){ $this->pid=$_GET['pid']; } public function get(){ ...

PHP 5 and Zend MVC on Windows and IIS

Are there any major issues to be aware of running a PHP 5 / Zend MVC production application on Windows? The particular application is Magento, an ecommerce system, and the client is really not interested in having a Linux box in their datacenter. Has anyone had luck getting PHP 5 and Zend MVC working correctly on IIS? ...

How to drop WIMP for LAMP

Does anyone have an example of something that can not be done on a Windows2000 server using PHP5? UPDATE: Just to clarify, my problem isn't with IIS, or that I'm an "only open source" kinda guy. It's that the hosting is a terrible package across the board. The storage and bandwidth are ridiculous, there's no control panel so in order t...

Should I add AJAX logic to my PHP classes/scripts?

I just started making a PHP/AJAX site and I was wondering where I should add the functionality to "only include the content". Should I have if statements in my header and footer scripts that check for a "ContentOnly" get parameter? And then append that parameter to the query strings in my AJAX calls? Or should I use a filter on the AJ...

accessing php arrays with explicit strings as index

I know that it's more performant to use '' delimited strings rather than ""... but I was wondering if there's any performance improvemente doing this $a = array( 'table' => 'myTable', 'order' => 'myOrder' ); $table = $a['table'] instead of $a = array( table => 'myTable', order => 'myOrder' ); $table = $a[table] I guess so, bu...

Exceptions in PHP - Try/Catch or set_exception_handler?

I'm developing some lower end code in my system that uses multiple child classes of the php exception class. Essentially I have the exceptions broken up to a few categories. What I'm wanting to do is two things. I need all exceptions that are fired in the application to be handled in a single place. I need to be able to log and the...

Using ODBTP from Linux client to MSSQL - response error

I have MSSQL running on a Windows server. I can connect to it using ODBTP, ADODB and PHP from other windows servers. When I try the same thing on a Linux server, I get a response error: [ODBTPERR][0]Invalid Response in /var/www/html/Database/adodb5/drivers/adodb-mssql.inc.php on line 726:[ODBTPERR][0]Invalid Response The ODBTP (v1.1.4) i...

Scrape and generate RSS feed

I use Simple HTML DOM to scrape a page for the latest news, and then generate an RSS feed using this PHP class. This what I have now: <?php // This is a minimum example of using the class include("FeedWriter.php"); include('simple_html_dom.php'); $html = file_get_html('http://www.website.com'); foreach($html->find('td[width="380...

What factors make PHP Unicode-incompatible?

I am able use UTF-8 characters just fine in my scripts. As a matter of fact it is possible to have names of variables and functions contain Unicode characters. There is also the mb_string extension, which deals with multi-byte strings. Yet in countless articles, PHP is criticized for its lack of Unicode support. I don't get it; why is PH...

Is it possible to skip parameters that have default values in a php(5) function call?

I have this: function foo($a='apple', $b='brown', $c='Capulet') { // do something } Is something like this possible: foo('aardvark', <use the default, please>, 'Montague'); ...

Can I have different versions of php installed and running on my server?

My friend has allowed me to have access to his server, he has been coding PHP a lot longer than me and still uses php version 4.3.9 and doesn't want to upgrade this current version. Is there anyway for me to install php version 5.2 and use that while he still runs 4.3.9? I require some functions which are only available in 5.2. The serve...

Modular web site with zend framework, stack of actions

How to build modular web site with Zend framework. I have pages in db, every page is represented as url. Every page has 1toN contents. Every content has controller, action and position (+other now not important columns). So, one request is one page and multiple contents (multiple actions). How can I build all actions before the output? I...

Zend framework (1.7.5): how to change controller directory

Using Zend Framework I want to use controllers stored in a directory which is not default. What I'm trying to achieve is that if the requested path begins with admin/ controllers/admin is used, with layout/admin and views/admin etc. How would I go about achieving this in a reasonably graceful manner? ...

matching an IP to a CIDR mask in php5?

I'm looking for quick/simple/(maybe built in that i never noticed before), method for matching a given IP4 dotted quad IP to a CIDR notation mask. I have a bunch of IPs I need to see if they match a range of IPs. example: $ips = array('10.2.1.100', '10.2.1.101', '10.5.1.100', '1.2.3.4'); foreach($ips as $IP) { if( cidr_match($IP,...

Sending large files reliably in PHP

Hi I have a php script on a server to send files to recipents: they get a unique link and then they can download large files. Sometimes there is a problem with the transfer and the file is corrupted or never finishes. I am wondering if there is a better way to send large files Code: $f = fopen(DOWNLOAD_DIR.$database[$_REQUEST['fid']][...

Please Critique my PHP authentication efforts

After posting this a while back, I decided to create my own Registration / Authentication capability in PHP. I'd love anyone to point out the flaws / opportunities for improvement, particularly around what's stored in the session... The logical flow is: 1 - User Registers using email as username, a "site name" which then forms part of...

Using PHPUnit in Zend Framework version 0.7

We have an application developed using Zend Framework preview version 0.7. Now I would like to write unit test its controllers / logic files. The logic mostly deals with the database and for database I am using my own wrapper. Did anybody try unit testing an application on top of Zend Framework version 0.7 ? ...

file_get_contents: failed to open stream: Host is down

Hello, I am running php5 on my mac osx 10.5. If I write a simple php script: <?php file_get_contents('http://www.google.com'); ?> And run it in the command line, I get the following error: "Warning: file_get_contents(http://www.google.com): failed to open stream: Host is down" I'm not sure if I'm missing some setting in php.ini or ...

DOMXML, PHP4 => PHP5

I have a script running on a server with PHP4 that uses DOMXML. Now I have to migrate the site (incl. the script) to a new server running PHP5 and it seems that DOMXML isn't working properly anymore. Is there an easy way to fix this? Thanks. ...

Install PHP 5 without libxml2

I am trying to install a copy of PHP 5 to my home directory on the school computer. The problem is that whenever I try, it complains that my copy of libxml2 is too outdated to work. Is there any way I can install this without upgrading libxml2, since I don't have permission to upgrade. Any suggestions? ...