php

How do you set up database testing using the PHP SimpleTest framework

I am using SimpleTest, a PHP-based unit testing framework. I am testing new code that will handle storing and retrieving website comments from a database. I am at a loss for how to structure the project to test the database access code. I am looking for any suggestions as to best practices for testing db code in a PHP application. Examp...

PHP website, should I develop into a Linux distribution instead of Windows?

Hi, In few months I start a project in PHP and I am hesitating to do like usual : develop on my Windows Vista 64bits machine. Since I know few things on Linux, I think it can be a good way to learn by working on a Linux distribution. Do you think it's a good idea or not? I would run a VirtualBox with Ubuntu (on my Vista64bits). I was t...

How do I convert Word smart quotes and em dashes in a string?

I have a form with a textarea. Users enter a block of text which is stored in a database. Occasionally a user will paste text from Word containing smart quotes or emdashes. Those characters appear in the database as: –, ’, “ ,†What function should I call on the input string to convert smart quotes to regular quotes and emdashes...

Which PHP-based CMS or framework has the best documentation?

I'm part of a group that's considering a PHP-based system to serve a community for communications purposes, including collaboration, event calendars, and a photo gallery. We're also loking into social networking integration (particularly Facebook) and maybe payment processing for community events. The two main CMSs we're considering ar...

What do you recommend for setting up a shared server with php

What do you recommend for setting up a shared server with php from a security/performance point of view? Apache mod_php (how do you secure that? other than safe_mode as it won't be in PHP6) Apache CGI + suexec Lighttpd and spawn a FastCGI per user LE: I'm not interested in using an already made control panel as i'm trying to write my...

How do you strip out the domain name from a URL in php?

Im looking for a method (or function) to strip out the domain.ext part of any URL thats fed into the function. The domain extension can be anything (.com, .co.uk, .nl, .whatever), and the URL thats fed into it can be anything from http://www.domain.com to www.domain.com/path/script.php?=whatever Whats the best way to go about doing this...

PHP HTML generation - using string concatention

A question about different methods of outputting html from PHP; what are the performance differences between these: Method 1 - variable concatenation $html = ''; $html .= '<ul>'; for ($k = 1; $k < = 1000; $k++){ $html .= '<li> This is list item #'.$k.'</li>'; } $html .= '</ul>'; echo $html; Method 2 - output buffering ob_start()...

How to install PHP/CURL?

I tried to follow PHP.net curl site and even this link: http://curl.phptrack.com/forum/viewtopic.php?t=52 and try to install the CURL in my window laptop. It doesn't work.. CURL is not installed. I wonder do I need to run it on windows server... Anyone has good sites guiding me how to install CURL? thanks. ...

PNG Creation in PHP (is it different than gif and jpg?)

I have a image upload form that should take image types (PNG, JPEG, GIF), resize it and then save it to a path. For some reason I can't get the PNG file types to work, it works fine with JPEG/GIF and the file is copied so it looks like it's something to do with how I'm creating the PNG. Does PNG creation in PHP require different para...

How can I find an application's base url?

I'd like to find the base url of my application, so I can automatically reference other files in my application tree... So given a file config.php in the base of my application, if a file in a subdirectory includes it, knows what to prefix a url with. application/config.php application/admin/something.php application/css/style.css S...

Grabbing rows from multiple tables as single result?

I have 2 tables. Table1 has fields A, B, C, D and Table2 has fields A, B. Field A and B of both tables have same record type. I would like to grab the records from both tables of fields A and B as single result. Is there any Query or Function in PHP+MySql? Thanks... ...

Best practices: What's the best way for constructing headers and footers? Call it all from the controller, or include from the view file?

Best practices: What's the best way for constructing headers and footers? Call it all from the controller, or include from the view file? I'm using Codeigniter. What's best practice? Loading all the included view files from the controller, like this? class Page extends Controller { function index() { $data['page_title'...

PHP - CodeIgniter - Usage

I am trying to learn CI to use for a shopping site, but am not having luck with the official doc. Anyone know of stuff that will help? ...

php cURL iis 6.0 windows server 2003

having issue setting up cURL with iis 6.0, windows server 2003, php 5.2.6 have installed to C:\PHP set PHPRC = C:\PHP\php.ini copied ssleay32.dll andlibeay32.dll to C:\PHP in php.ini, uncommented the line extension=php_curl.dll extension_dir="C:\PHP\ext" c:\php\ext has the dll php_curl.dll EDIT 1: C:\PHP is in PATH still getting...

Why does Eclipse code completion not work on some projects?

I have Eclipse 3.3.2 with PDT doing PHP development. All projects that I create, even SVN projects have code completion. Now I just opened another SVN project and it has no code completion or PHP templates (STRG-space does nothing in that project). However, I can open the other projects and code completion all work in them. Why would co...

Does .Net do clever connection management like PHP?

During an ASP.NET page load I'm opening and closing multiple System.Data.SqlClient.SqlConnections inside multiple controls contained in the page. I thought it would be a good idea instead to create a "pool" of connections and when opening a connection check to see if the connection string matches that of an open connection in the pool, a...

Book recommendations: C for PHP programmers

I've been developing with PHP for a couple of years now, and have a strong grounding in it. But I'd like to learn more about programming languages in general, and want to be introduced to more low-level stuff. I've decided to learn C, and wanted to get your book recommendations. PHP has been pretty simple for me so far (including the OO...

Best Practices : Where to place required files

I'm working with a number of 'helper' classes, which affectively have a bunch of static functions which allow the controllers and actions have access to chunks of shared functionality. Problem is that these files have been used as a dumping ground for any functionality which is required across the modules/application and as a result the...

Best Practice: include( or <script src="

I have minified my javascript and my css. Now, Which is better? <script type="text/javascript"> <? $r = file_get_contents('min.js'); if($r) echo $r; ?> </script> OR <script type="text/javascript" src="min.js"></script> Same question for CSS. If the answer is 'sometimes because browsers fetch files simultaneously?' Which brow...

In PHP (>= 5.0), is passing by reference faster?

In PHP, function parameters can be passed by reference by prepending an ampersand to the parameter in the function declaration, like so: function foo(&$bar) { // ... } Now, I am aware that this is not designed to improve performance, but to allow functions to change variables that are normally out of their scope. Instead, PHP see...