php

Directory Sizes on Remote Host

My hosting company does not provide an interface for me to see which folders are consuming the most amount of space so what I'm looking for is something that will show me the size of each folder within my main folder recursively, I don't know of anything on the Internet, and did a few searches however I came up with no results. This is ...

A Good, Scalable Webhost For PHP

I'm currently in the process of looking for a webhost for PHP that is feature rich (cheap is not a priority here), has excellent technical support and can scale along with the website. Essentially, is there anything like Engine Yard for PHP? ...

PHP and JavaScript regex

After my webform is submitted, regex will be applied to user input on the server side (via PHP). I'd like to have the identical regex running in real-time on the client side to show the user what the real input will be. This will be pretty much the same as the Preview section on the Ask Question pages on StackOverflow except with PHP on ...

Why would getcwd() return a different directory than a local pwd?

I'm doing some php stuff on an Ubuntu server. The path I'm working in is /mnt/dev-windows-data/Staging/mbiek/test_list but the PHP call getcwd() is returning /mnt/dev-windows/Staging/mbiek/test_list (notice how it's dev-windows instead of dev-windows-data). There aren't any symbolic links anywhere. Are there any other causes for getc...

How to handle error logging

Until recently I've been using syslog in my System_Exception exception handler to log important errors - a pretty useful concept I thought. However my host just cut me off, and it appears that loveable syslog has actually been sending my error reports to everyone on the server (it's a shared server). They weren't too pleased. I've now s...

Is this a reasonable way to handle getters/setters in a PHP class?

I'm going to try something with the format of this question and I'm very open to suggestions about a better way to handle it. I didn't want to just dump a bunch of code in the question so I've posted the code for the class on refactormycode. base-class-for-easy-class-property-handling My thought was that people can either post code sn...

Can PNG image transparency be preserved when using PHP's GDlib imagecopyresampled?

The following PHP code snippet uses GD to resize a browser-uploaded PNG to 128x128. It works great, except that the transparent areas in the original image are being replaced with a solid color- black in my case. Even though imagesavealpha is set, something isn't quite right. What's the best way to preserve the transparency in the res...

Pulling limited tagged photos from Flickr

So I've got a hobby site I'm working on. I've got items that are tagged and I want to associate those items with photos from Flickr. Even with restrictive searches I might get results numbering in the thousands. Requirements: I want to display between 10-20 pictures but I want to randomize the photos each time. I don't want to hit F...

How to make 'pretty urls' work in php hosted in IIS?

Is there some way I can use urls like: http://www.blog.com/team-spirit/ instead of http://www.blog.com/?p=122 in a windows hosted php server? ...

Deployment tool for LAMP

Are there any good deployment tools that can be used with LAMP and Subversion? Ideally it would handle both code updates and database migrations. ...

Looking for News and Podcast CMS

I feel I have outgrown Wordpress for where I want to take my website. I would prefer to start with a CMS core so I don't have to program that all from scratch, but am not having any luck. PHP or .NET are both options for me. Other languages are a possibility, but really depend on how much programing I would have to do. The front-end log...

Need a way to kick of a php script each time a particular account receives an email

Working on a little side project web app... I'd like to have it set up so that, when users send email to a certain account, I can kick off a php script that reads the email, pulls out some key info, and writes it to a database. What's the best way to do this? A cron job that checks for new email? The app is running on a "Dedicated-Vir...

Cocoa tips for PHP developers?

I'm a PHP developer, and I use the MVC pattern, and object oriented code. I really want to write applications for the iPhone, but to do that I need to know Cocoa, but to do that I need to know Objective-C 2.0, but to do that I need to know C, and to do that I need to know about compiled languages (versus interpreted). Where should I be...

Wordpress MediaWiki Integration

On the other end of the spectrum I would be happy if I could install a Wiki and share the login credentials between WordPress and the Wiki. I hacked MediaWiki a while ago to share logins with another site (in Classic ASP) via session cookies and it was a pain to do and even worse to maintain. Ideally I would like to find a plug-in or s...

How to determine if an html tag splits across multiple lines

I'm writing a php script that involves scraping web pages. Currently, the script analyzes the page line by line, but it breaks if there is a tag that spans multiple lines, like <img src="example.jpg" alt="example"> If worse comes to worse, I could possibly preprocess the page by removing all line breaks, then re-inserting them at the...

Determining width of a printed string by a webapp

In my (PHP) webapp, I have a part of my site that keeps a history of recent searches. The most recent queries get shown in a side box. If the query text is too long, I truncate it and show ellipses. Eg: "My very long query is..." Currently, I truncate after a certain number of characters. Since the font is not monotype, a query of all I...

Online PHP IDE

Is there an IDE for PHP where you can edit the code for your pages online? Real syntax highlighting is minimal. More would be great. I'd like to be able to do development on my site at times other than when I'm not at at home. ...

php scripts writing to non-world-writable files

How can you allow a php script to write to a file with high security restrictions, such as only allowing a single user to write to it? The difficulty seems to be that a php script is running as a low-permissions user (maybe apache, or www, or nobody?), and even if I chown apache the_writable_file, the directory it's in might not be writ...

HTML Scraping in Php.

I've been doing some html scraping in PHP using regular expressions. This works, but the result is finicky and fragile. Has anyone used any packages that provide a more robust solution? A config driven solution would be ideal, but I'm not picky. ...

Simple test vs PHPunit

I was wondering if anyone that have experience in both these stuff can shed some light on the significant difference between the two, if any? Any specific strength of each that makes it suitable for any specific case? ...