php

Why would apc_store() return false?

The documentation on php.net is very spotty about causes of failure for APC writes. What kind of scenarios would cause a call to apc_store() to fail? There's plenty of disk space available, and the failures are spotty. Sometimes the store operation will succeed and sometimes it'll fail. ...

PHP IF statement for Boolean values: $var === true vs $var

I know this question is not really important.. however I've been wondering: Which of the following IF statements is the best and fastest to use? <?php $variable = true; if($variable === true) { //Something } if($variable) { // Something } ?> I know === is to match exactly the boolean value. However is there really any im...

How do I create a Google Map using v3 API with clickable markers with custom html inside the marker?

I have a database full of addresses and pictures of those locations. Note: I do not have the latitude / longitude. What I need to do: Write a function that uses Google API v3 to list a few of these addresses on a Google map, that when you click on the marker, it displays the address and the picture from the database. This is a plugin f...

How can I develop Rails alongside a XAMPP installation?

On my work machine, I do PHP development under XAMPP, which includes Apache and MySQL. I'd like to start developing and testing some Rails code on the same machine - also using MySQL (and I assume it also needs Apache). What's the easiest way to do this without conflicts? ...

How to use HTML Image Button and PHP?

Okay, so here's the scenario. I have a simple HTML page: <html> <head> </head> <body> <form action="submit.php" method="get"> <input type="image" src="btn_getStarted.png" name="getStarted" value="btnBasic1" alt="Submit" /> </form> </body> </html> Along with the submit.php page: <?php if(isset($_GET['getStarted'])) { ...

ISO-8859-1 encoding to windows-1250 with php?

Hi, i need to import XML to mysql database. It is imported in ISO-8859-1 encoding. Well, it is very old mysql version 4.0.27 + php 4. The problem is - when I take texts from database to website I need to change encoding to windows-1250. I have no idea why, but iconv or mb_convert_encoding doesnt work (it does something, but it still lo...

ajax - display data as they become available from the server

Hello, I need a kayak.com like, functionality. That is, the user enters a keyword and I will need to display results as the become available. The important thing is that data should be displayed AS it BECOMES available. Kind of progressive display? Don't know if this is right term. Kayak.com displays or gives the impression that data i...

can zend_form be used with pagination?

Hi, I am not sure if this is the most sensible way of doing this but I thought I would ask anyway. I have a 'wizard' that I am developing for users to review data that is stored in the database. Each part of the wizard is a simple Zend_Form allowing the users to review and edit the data. However one element of the wizard needs to be a...

Protecting PHP classes from undesired instantiation?

I am working on a PHP library in which we will be supplying our clients with encrypted code. The code will include a main classes which they can instantiate that will handle license verification and expose methods for their use. The main class will instantiate several sub classes each contained in their own file. How can I prevent our...

How much mail() function can be used in 30sec execution time?

I have to made a page which will send Email to Newsletter subscribers. There is more then 14000 subscriber. I want to use php mail() function to send Email to them. But I'm afraid that it will not be able to send email to all subscribers for php 30sec max_execution_time limit. Its not possible to test how much Email can be sent by sendin...

Nginx rewrite rule: check for nonexistant files and folders

I'm trying to set-up nginx rewrite rules as the following: Original structure: domain.com/index.php?site=project Now I tried to mask it using the nginx rewrite engine: if (-f $request_filename) { break; } if (!-f $request_filename) { rewrite ^/(.+)$ /index.php?site=$1 last; break; } How do ...

convert date to unixtime php

I have a form which posts date information month, day, yeah, hour, minute, am/pm. How do i encode/decode this to and from unixtime using php? ...

Symfony and Lucene

SOLVED See my answer below. Question left unchanged for anyone else who has trouble with this. I'd like to use lucene (or anything else that could be used withs symfony for searching really) however I can't get the sfLucene plugin to work (says there are no tasks in the namespace "lucene" when i do ./symfony lucene:initialize). What ...

Do variables transfer over from one seperate script to another via PHP?

I have a script that has PHP on it, and a link that goes to a new script that alters that PHP. When writing the query and containing variables on the second script, do I need to use the same variables or are the new ones I create completely seperate? or can will the variables from the first script carry over to the second script if used?...

How to change the locking mechanism in Alternative PHP Cache (APC)?

I recently read in a presentation on Scribd that Facebook had benchmarked a variety of locking mechanisms for APC including file locks (default), IPC semaphore locks, linux Futex locks, pthread mutex locks, and spin locks. You can view this presentation by clicking the following link: APC@Facebook I was wondering if anybody knew off ha...

using regex in php to add a cell in a row

As usual I have trouble writing a good regex. I am trying to make a plugin for Joomla to add a button to the optional print, email and PDF buttons produced by the core on the right of article titles. If I succeed I will distribute it under the GPL. None of the examples I found seem to work and I would like to create a php-only solution....

Declaring lots of variables for phpdoc without starting each with /**

I have objects with many variables that I declare and explain in the comments. I am commenting very thoroughly for later processing using phpDoc, however I have no experience with actually compiling the documentation yet. I find it very annoying that with phpDoc notation, each variable eats up four to six lines of code even if the only ...

jQuery ID Selection dynamic

Not Sure if this can be done, the way I am approaching it. Here goes nothing. I am echoing images from a php upload script, each img has a unique ID which starts at A1,A2,A3,A4 and so on. Now I can select That img ID and create the action I want, however I have to do it for every ID, I wont be able to do this as new ones are created, How...

PHP 2D/3D Dynamic Graphing Tool Kit Running on Linux

Does anyone know of a high quality PHP based graph library that I can use I have already looked at pchart (http://pchart.sourceforge.net/). PChart produces pixelated line graphs and does not really have any great 3D graphs? Also I would rather not use Java because of the client side aspect. ...

php fopen disabled - alternative needed

My web host just disabled fopen() My script used to open and write to a text file on the server, but no longer can. Is there an alternative function to fopen? ...