php

What is the difference between the -a and -o options when you use the Pear installer?

When you use the Pear installer, like pear install DB you can use the '-a' option or the '-o' option. What is the difference between them? @Ólafur Waage I want to ask the difference between all and only. I cannot understand what they are. What are the 'all' dependencies and what the 'only' dependencies? Are there any diff...

Which compression method to use in PHP?

I have a large amount of data to move using two PHP scripts: one on the client side using a command line PHP script and other behind Apache. I POST the data to the server side and use php://input stream to save it on the web-server end. To prevent from reaching any memory limits, data is separated into 500kB chunks for each POST request....

PHP warning: headers already sent in Unknown

I'm looking for things that might trigger the following PHP warning: PHP Warning: Cannot modify header information - headers already sent in Unknown on line 0 ...

PHP: return life of current session

I am looking for a way to check on the life of a php session, and return the number of seconds a session has been "alive". Is there a php function that I am missing out on? ...

How can I get all response segments in Zend Framework?

I'm using several response segments which I push on my action stack like this: $userlogAction = clone($request); $userlogAction->setActionName('userlog')->setControllerName('index'); $actionStack->pushStack($userlogAction); Now when I test for the current action in my view: $request = Zend_Controller_Front::getInstance()->getRequest(...

Passing Information Between PHP Pages

How do I pass information between PHP pages? For example, I have a PHP script to process login input from a form, and then a separate PHP script to process further input for the user. However, I want the second PHP file to receive the input from the login form. In essence, I do not want the same script being run twice for the login. ...

Permissions problem when uploading images using PHP in IIS

We have just moved a website to a new server, both servers are Windows Server 2003 running IIS as the web server. When uploading images we require that the uploaded files have certain permissions for the NETWORK SERVICE account. Images are uploaded using PHP, they are then filtered by ImageMagick using the mogrify.exe binary for resizin...

How do I decide if a failed system process like a database query or automated email merits an error message to the user?

I'm thinking through all the points in my PHP application where it performs some sort of system process like database queries, or sending out an email, and I'm wondering if at all these points I should be notifying a user when something goes wrong. There are so many points where an application can fall apart, that I'm having trouble dete...

Abandon Long Processes in PHP (But let them complete)

I have an HTML form that submits to a PHP page which initiates a script. The script can take anywhere from 3 seconds to 30 seconds to run - the user doesn't need to be around for this script to complete. Is it possible to initiate a PHP script, immediately print "Thanks" to the user (or whatever) and let them go on their merry way while...

Learning a web language

I am wondering what other people have experienced in creating a web service application, what language/framework is best suited for a beginner? Are there characteristics of the chosen language that make it better suited to programmers of a certain way of thinking that makes language XYZ appeal to particular programmers more? I'm looking...

An example of arrays being used in web development

I was talking to a person today who mentioned he used arrays when calling parameters or for other reasons when pulling data from the database etc. Basically my question is: how would you use arrays in web development? For example: If you had a url like this (a social dating site) http://www.example.com/page.php?sid=1&agefrom=30&a...

PHP build/integration tools: Do you use them?

After reading the "Modern PHP workflow" article in the November 2008 edition of php|architect magazine which discussed unit testing (phpUnit), build tools (Phing) and continuous integration (Xinc), I'm inspired the learn more about some of the tooling available for PHP, especially Phing. In the past I've often handled deployment to a p...

Help with basic .htaccess mod_rewrite.

I am currently interpreting sub-domain wild-cards with php and i would like to handle them with .htaccess, user profiles will be accessed at http://username.mysite.com/ (or for some people http://www.username.mysite.com/) which should use /main.php?action=profile The hardest part of this is making /error/i+am+a+test+message or /files/ia...

.htaccess files when hosting Drupal 6 sites on IIS 7?

I want to run Drupal 6 on our Windows 2008 server using the included IIS 7 web server. There are a few blogs giving various instructions on doing so, but when I try to create Drupal sites and/or active some modules using IIS 7, I get error messages about creating folders and/or missing .htaccess files. It looks like Drupal relies on .h...

Does PHP have a function to detect the OS it's running on?

I wouldn't know under what keyword to look for this in the PHP database, so I'm asking here. Reason I want to know is because of how different Operating Systems handle new lines in textdocuments. I'm using a CSV file in windows but each time I think I add a new line, what really happens is the new line gets pasted to the back of the la...

Protecting HTML files with .htaccess

My PHP app uses 404 Documents to generate HTML files so that multiple queries to the same HTML file only cause the generation to run once. I'd like to intercept requests to the HTML files so that the user needs to have an established PHP Session in order to pull up the files. In the best case, SESSION ID would be used in the URL and fo...

Group By and displaying entries under date

Here's my data: id date 1 2009-01-01 10:15:23 2 2009-01-01 13:21:29 3 2009-01-02 01:03:13 4 2009-01-03 12:20:19 5 2009-01-03 13:01:06 What I'd like to do is group by each date and then list the id numbers below each date. Should I be getting the distinct date values and then cycling through them to get the entries that fa...

Help with basic .htaccess mod_rewrite. (More defined)

This is a continuation of: http://stackoverflow.com/questions/623161/help-with-basic-htaccess-modrewrite I was told to use RewriteRule ^error/(.*) index.php?error=$1 [L] RewriteRule ^file/(.*) index.php?file=$1 [L] and RewriteCond %{HTTP_HOST} !^www\.mysite\.com$ [NC] before each, but it dosn't really help me specifically. I am u...

Inserting mm/dd/yyyy format dates in MySQL

How can I insert an MM/DD/YYYY format date into an MySQL database using PHP? ...

Is it possible to speed up a recursive file scan in PHP?

I've been trying to replicate Gnu Find ("find .") in PHP, but it seems impossible to get even close to its speed. The PHP implementations use at least twice the time of Find. Are there faster ways of doing this with PHP? EDIT: I added a code example using the SPL implementation -- its performance is equal to the iterative approach ED...