Posted by nick | Posted in Development | Posted on Jun 28 2010
If while debugging with Zend Studio for Eclipse you get the error “select the local resource that matches the following server path” there are two possible solutions.
First, the easy one. If you opened the file from the explorer windows and not through Eclipse, the file is not open in the project so it doesn’t know where the other resources are. The open declaration ability will not work either.
IF that didn’t work, try this next change. If you have external libraries that are used in your application, first add the library to the build path of your project. Then, if you get the pop error while debugging: “select the local resource that matches the following server path” and “get content from the server for the following path”, you must map the paths as explained below.
Adding a Server Location Path Map
This procedure describes how to add a Path Map to a server so that files which are called from a certain location on the server will be searched for in a local location during remote PHP Script debbuging/profiling and PHP Web Page debugging /profiling. This will only apply when the ‘use local copy’ option is selected in the Advanced tab of the PHP Web Page debugging configuration) .
To add a Path Map to a server:
- Open the PHP Servers Preferences Page by going to Window | Preferences on the Menu Bar and selecting PHP | PHP Servers from the Preferences list.
- Select the server on which you would like to create the Path Map and click Edit.
- In the Edit Server dialog, select the Path Mapping tab.
- Click Add.
- An Add new Path Mapping dialog appears.
- Enter the Server Path from which you would like to create the Path Map. Files called from this location will be searched for in the path specified below.
- Select either the ‘Path in Workspace’ or ‘Path in File System’ option and click Browse to specify the location.

Your
Path Map will be added to your server list.

Path
Mapping Settings
The next time a file is called from the Path on Server, it will
be searched for in the local location you have specified.
Posted by nick | Posted in PHPUnit | Posted on Jun 21 2010
I’m using Zend Studio 7.2 on Windows 7 with Zend Framework 1.10 and Zend Server CE. I’ve created a PHPUnit test case with Zend Studio and am able to run it successfully via the command line. I’d like to use Zend Studio’s interface, but when I run the test case I get the following error “Fatal error: Cannot redeclare class PHPUnit_Util_FilterIterator in C:\Program Files (x86)\Zend\Apache2\htdocs\library\pear\pear\PHPUnit\Util\FilterIterator.php on line 162″ .
Update: I got past this error. The problem was related to having both my custom install of PHPUnit and the PHPUnit built into Zend Studio on the include path of the project. Remove one of them and it should work.
Posted by nick | Posted in Development, PHP | Posted on Jun 18 2010
After about ten hours of fighting with PEAR and PHPUnit, I think I have it installed correctly as my test case was able to run. There are a couple “official” documentation sources on how to install PHPUnit, but they only bother to cover installing it on linux. Further, PHPUnit has evolved quite a bit over the past few years and its configuration seems to have changed. I wouldn’t even bother installing PEAR if you don’t want to because the PHPUnit version from PEAR is grossly outdated. As of now, the currently version of PHPUnit is 3.4.9. If you install pear and phpunit from the command line as I tried a couple times, the phpunit.bat file will not be updated as it should, so phpunit will not work. If you open phpunit.bat and see these lines “set PHPBIN=”@php_bin@”
%PHPBIN% “@bin_dir@\phpunit” %*”, then you know something didn’t work right.
-
To install manually as I did, go to http://pear.phpunit.de/get/ to download the latest version of PHPUnit. Extract the files to a directory that is listed in the include_path of your php.ini configuration file. If you’d like to place it in a custom location, add that location to the include_path in your php.ini file.
-
Find the phpunit.bat file that you extracted, open it with a text editor and change the @php_bin@ string in it with the path to php.exe. Get rid of this line “%PHPBIN% “@bin_dir@\phpunit” %*” as it won’t be needed. On the line below, add the following line to execute phpunit.php with php ‘php -d safe_mode=Off “C:\Program Files (x86)\Zend\Apache2\htdocs\library\pear\pear\phpunit.php” %*’. Remove the single quotes I added here and change the path to phpunit.php to the file’s location on your computer (the directory you extracted phpunit to).
In the end, your phpunit.bat file should look similar to this (with that paths to php.exe and phpunit.php changed to your file locations)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
| @echo off
REM PHPUnit
REM
REM Copyright (c) 2002-2010, Sebastian Bergmann <sb@sebastian-bergmann.de>.
REM All rights reserved.
REM
REM Redistribution and use in source and binary forms, with or without
REM modification, are permitted provided that the following conditions
REM are met:
REM
REM * Redistributions of source code must retain the above copyright
REM notice, this list of conditions and the following disclaimer.
REM
REM * Redistributions in binary form must reproduce the above copyright
REM notice, this list of conditions and the following disclaimer in
REM the documentation and/or other materials provided with the
REM distribution.
REM
REM * Neither the name of Sebastian Bergmann nor the names of his
REM contributors may be used to endorse or promote products derived
REM from this software without specific prior written permission.
REM
REM THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
REM "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
REM LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
REM FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
REM COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
REM INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
REM BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
REM LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
REM CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRIC
REM LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
REM ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
REM POSSIBILITY OF SUCH DAMAGE.
REM
set PHPBIN="C:\Program Files (x86)\Zend\ZendServer\bin\php.exe"
php -d safe_mode=Off "C:\Program Files (x86)\Zend\Apache2\htdocs\library\pear\pear\phpunit.php" %* |
To test your install, go to the command line on windows and type “phpunit” and hit enter. If you don’t see any errors, then it’s installed correctly.
Other Issues
Using Zend Server 5.0, Zend framework 1.10, and PHPUnit 3.4.9, I had to apply a couple patches or bug fixes to get things to work.
- I received the error “Fatal error: Cannot redeclare class PHPUnit_Framework_TestCase” . The Zend Studio template for a test case automatically includes
1
| require_once 'PHPUnit\Framework\TestCase.php'; . |
Change this to
1
| require_once 'PHPUnit\Framework.php'; |
for each test case. The bug report for this issue is located at http://framework.zend.com/issues/browse/ZF-9380
-
Posted by nick | Posted in Doctrine ORM | Posted on Jun 14 2010
Some personal notes on using Doctrine’s relationships -
In order for the relationships to be populated, such as the hasOne or hasMany as specified in the setUp method, you must write your query using the Doctrine_Core::getTable method. Using Doctrine_Query::create will return only the result set from that query and non of the relationships.
Posted by nick | Posted in Ecommerce | Posted on Jun 05 2010
Today I requested closure of our Amazon.com seller account after four months. I have briefly listed below the main reasons for the cancellation. You can read more detail of our initial problems with amazon holding our money and not paying us.
Selling on Amazon was too competitive for our type of product, which means little to no profit. Amazon’s 15% cut on sales plus $40 per month pro merchant account fees took most of the profit.
Too much time to manage orders. I wrote programming to allow order imports based on an “order report” from amazon so speed things up. However, entering tracking numbers and constantly requesting feedback to keep our account open was tedious time consuming.
On Amazon, buyer wins all disputes no questions asked as Amazon takes your money immediately. If the buyer supplies you with an incorrect shipping address, it’s on you to pay the UPS reroute fees and/or reship the product.
Zero Customer Service. You’ll never talk to a real person and will only get prefabbed customer support responses.
Amazon works hard at keeping the customers purchasing though their site. The only way we could earn any money from these customers is if they purchased directly from our online website for follow up orders rather than use Amazon and that was not happening. Amazon will not provide you with the customer’s email address and they’ll suspend your account if you include any hyperlinks or your store name in any communications to them. Smart on Amazon’s part, but keeps sellers from making any money.
The last straw is when Amazon again started holding our money. They’re holding $8,000 of our money as “reserve” and instead paying us only a few hundred dollars of our money ever other week. They are holding it for 90 days! That’s money I’m paying interest on while they’re out spending it! I cannot continue to finance this business relationship where we’re making little to no profit in hopes that we’d increase customer orders directly to our website, which unfortunately isn’t happening.
Good bye Amazon!