php

How to test a second parameter in a PHPUnit mock object

This is what I have: $observer = $this->getMock('SomeObserverClass', array('method')); $observer->expects($this->once()) ->method('method') ->with($this->equalTo($arg1)); But the method should take two parameters. I am only testing that the first parameter is being passed correctly (as $arg1). How do test the second...

url encoded forward slashes breaking my codeigniter app

i’m trying to create a url string that works like this: /app/process/example.com/index.html so in other words, /app/process/$URL i then retrieve the url with $this->uri->segment(3); the forward slashes in the URL will of course be a problem accessing uri segments, so i’ll go ahead and url encode the URL portion: /app/process/e...

Starting out doing server side things - what languages and techniques to choose?

I've been doing html, css and javascript for quite a long time, mostly for my very own enjoyment. I would say I know fairly much, I've created many simple games and apps and experiments with javascript. However there is only so much that is possible to do in the browser, for any more "complete" websites I am constantly confronted with my...

Best way to pass JSON from Browser to PHP using Ajax.Request

Hi I have a JSON object that is a 2-dimentional array and I need to pass it to PHP using Ajax.Request (only way I know how). ...Right now I manually serialized my array using a js function...and get the data in this format: s[]=1&d[]=3&[]=4 etc. .... my question is: Is there a way to pass the JSON object more directly/efficientely?..ins...

How to deal with xapian php exceptions

Help with using the xapian php wrapper. I have a couple of custom exception handlers for different categories of errors (I'm thinking of seperating them out more). Xapian handles errors by throwing standard Exception objects. I would like to use a custom exception handler for these though. How do I go about using a custom exception for...

Fetching attachments from gmail via either python or php.

I have been trying to find information on how to retrieve attachments from a gmail account in either python or PHP, I'm hoping that someone here can be of some help, thanks. Related: How can I download all emails with attachments from Gmail? ...

I'm using Zend gdata to open documents with hopes to read and write spreadsheet cells.

I'm not good at programming and my trying to open one of my spreadsheet documents. Below in the basic login im using, I then request a list all my spreadsheet, which is returned in $feed. And now I'm worried I'm not on the right track with opening a document so I can read and write cells. <?php require_once '../library/Zend/Loader.php...

Scaling LAMP

I have a client with a LAMP website serving mostly video. He is currently on one server with all components. He is having some scaling problems. What are some of the techniques that can be used to help. I used separating out the DB to another server with a GB Ethernet between it and the webserver. Maybe adding more web servers with some...

How to remove excess whitespace added to code by FTP program?

This happens repeatedly and is very annoying. I upload some PHP code to a client's server. A few weeks pass. They ask for a change to be made and I re-download the code as they've made some changes. However, my code which used to be neat and tidy the last time I looked at it now has an extra lines of whitespace added everywhere. So now w...

Upgrading from FPDF 1.53 to 1.6--any problems?

As I think most people know already, or if you don't, FPDF released a new version, 1.6 this past August after almost 4 years without a release. I'm wondering if anyone has had any problems upgrading from 1.53 to 1.6? ...

How do I use the email component from a model in CakePHP?

I have a very simple model. I want to add a send email routine to on of the methods for the model: $this->Email->delivery = 'smtp'; $this->Email->template = 'default'; $this->Email->sendAs = 'text'; $this->Email->from = 'email'; $this->Email->to = 'email'; $this->Email->subject = 'Error'; I've tried putting App::import(...

How do I run a file on localhost?

How do I actually run a file on localhost? I know it is working, but how do I run a file on it, and how do I verify that the file is in fact running on localhost? Server newbie here, additional questions (I have xampp running Apache 2.2): From your responses it sounds like I have to type in the path in the browser in order to open the f...

How to fix Apache instability ?

I have configured a simple LAMP stack on Debian and I am experiencing some problems with the Apache web server. Each 3-4 hours the web server is entering a deadlock and all the requests that hit the database block. The server is creating a new child for each request. The number of processes increases very quickly. After a few seconds M...

PNG Transparency with PHP

Hey having some trouble trying to maintain transparency on a png when i create a thumbnail from it, anyone any experience with this? any help would be great, here's what i am currently doing: $fileName= "../js/ajaxupload/tees/".$fileName; list($width, $height) = getimagesize($fileName); $newwidth = 257; $newheight = 197; $thumb = ima...

Is PHP or vanilla Perl CGI faster?

I'm developing a web app for an Apache shared hosting server. I have already written some code in Perl but I recently found out, to my surprise, the shared hosting provider does not provided mod_perl or a way to install it. I have been a bit worried that running a Perl web app through CGI without mod_perl would make it very slow? Shou...

Empty $_POST array in PHP 5.2.6 / IIS CGI

I am running into a very strange issue with PHP 5.2.6 w/ IIS on Windows XP (have tried both CGI and ISAPI). I am running a fresh installation with the default php.ini settings. First, assume the following (ugly, but effective) HTML code: <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post"> <input type="hidden" name="test1...

Annoying vim (un)indent rules

When editing PHP code (I'm not sure if it's specific to that language) and I create a new line in the middle of comma-separated lists that span multiple lines, the indent rules always unindent the line I'm leaving. Here's a video of it. This happens in arrays, function argument lists, etc. Is there anything I can do to stop this from ha...

Should a beginning PHP programmer consider frameworks?

I'm a complete beginner when it comes to programming. I'm taking a stab at PHP, and have seen how powerful the frameworks can be. But should I even consider trying to work with a framework until I have a strong grasp of PHP itself? Note: I'd most likely be using CodeIgnitor, but the question applies to any of the frameworks. ...

how to object initialize in PHP and then what function do I make within the class which runs automatically ?

hi i forgot the code which in a sample class you have to add so that it runs automatically? is it wakeup or something? like so: class something { function automaticxxx_something_which_runs when class is created() { } } $s = new something(); -what do i create in the class file so that something runs already after the class is ini...

Includes: SSI or PHP for basic HTML and Javascript in separate files

Thanks to everyone here, got the Xampp server running!!! and can run my html in subdirectories now, as well. (can't have spaces in the subdirectory names) NEXT UP - SSI Includes or PHP Includes Xampp says SSI is deactivated. Tried uncommenting the lines for includes, but it doesn't change the deactivation. How do I activate SSI? Then...