PTI (PHP Tool Integration) Questions..

General discussion on Zend Studio
mmmshuddup
Posts: 28
Joined: Fri Oct 22, 2010 6:44 am

PTI (PHP Tool Integration) Questions..

Post by mmmshuddup » Mon Nov 08, 2010 7:43 am

Somebody recommended installing this PTI plugin to Zend Studio for my CodeSniffing needs and things like that. I was able to successfully install it without problems with the dependencies (@see: viewtopic.php?f=79&t=7278&p=24625&hilit=PTI#p24625); however, when I run Code Sniffer within Zend Studio I don't get any actual CodeSniffing reports in the console.. All I see is a super long line of a command that was run but none of the actual output from the report is there..

I did a build of the whole project after updating my CodeSniffer settings and several files gave me this "error"(?):

Code: Select all

  dyld: Library not loaded: /usr/local/zend/lib/libpq.5.dylib
  Referenced from: /Applications/Zend Studio.app/Contents/Resources/Java/plugins/org.zend.php.debug.debugger.macosx_5.3.18.v20100905/resources/php5/php-cgi
  Reason: image not found
I tried to run "phpcs" from the command line but it did not work.. There's a very small about of documentation on the PTI site itself so I guess I assumed that installing this plugin would also make it work on the command line.. Was I mistaken or did something not install correctly? Help!

mmmshuddup
Posts: 28
Joined: Fri Oct 22, 2010 6:44 am

Re: PTI (PHP Tool Integration) Questions..

Post by mmmshuddup » Mon Nov 08, 2010 7:44 am

Sorry..by the way I am running Zend Studio 8 on OSX.

User avatar
jacek-p
Posts: 46
Joined: Mon Nov 02, 2009 1:28 pm

Re: PTI (PHP Tool Integration) Questions..

Post by jacek-p » Mon Nov 08, 2010 11:16 am

hi,

The error you're getting is quite strange, because indicates Zend Studio's php-cgi binary relating to some libpq.5.dylib (coming probably from Zend Server?). In typical Zend Studio scenarios, php-cgi would not try to load any external libs unless told so by user.

So if possible, I'd try to configure PTI to call php-cgi with custom php.ini precisely setting which libraries should be loaded. But I may be wrong, because I haven't used PTI.

Jacek

User avatar
rbzend
Zend Global Support
Posts: 536
Joined: Tue Dec 23, 2008 5:03 pm

Re: PTI (PHP Tool Integration) Questions..

Post by rbzend » Mon Nov 08, 2010 3:12 pm

The problem that you experience is due to the way we build PHP on MacOS (since Zend Studio 6). To run Zend Studio's PHP, execute the following commands:

Code: Select all

$ cd /Applications/Zend Studio.app/Contents/Resources/Java/plugins/org.zend.php.debug.debugger.macosx_5.3.18.v20100905/resources/php5
$ DYLD_LIBRARY_PATH=../lib ./php-cgi -v
Unfortunately, I cannot advise on CodeSniffer configuration.
Roman Basayev
Rogue Wave Support
https://support.roguewave.com/

mmmshuddup
Posts: 28
Joined: Fri Oct 22, 2010 6:44 am

Re: PTI (PHP Tool Integration) Questions..

Post by mmmshuddup » Tue Nov 09, 2010 8:10 am

rbzend wrote:The problem that you experience is due to the way we build PHP on MacOS (since Zend Studio 6). To run Zend Studio's PHP, execute the following commands:

Code: Select all

$ cd /Applications/Zend Studio.app/Contents/Resources/Java/plugins/org.zend.php.debug.debugger.macosx_5.3.18.v20100905/resources/php5
$ DYLD_LIBRARY_PATH=../lib ./php-cgi -v
Unfortunately, I cannot advise on CodeSniffer configuration.
I ran the commands as you advised like so:

Code: Select all

$ cd /Applications/Zend\ Studio.app/Contents/Resources/Java/plugins/org.zend.php.debug.debugger.macosx_5.3.18.v20100905/resources/php5
$ DYLD_LIBRARY_PATH=../lib ./php-cgi -v
PHP 5.2.14 (cgi-fcgi) (built: Aug 11 2010 15:34:46)
Copyright (c) 1997-2010 The PHP Group
Zend Engine v2.2.0, Copyright (c) 1998-2010 Zend Technologies
    with Zend Debugger v5.3, Copyright (c) 1999-2010, by Zend Technologies
Then I went back into Zend Studio 8 and reattempted to run PHP Code Sniffer on one of my modules and go the same results. So I restarted Zend Studio and again and the same thing happened. To be honest I've never really understood how PHP worked in Zend Studio.. But based on what you just said, apparently Zend Studio installs it's own copy of PHP and uses that for certain things.. If that's the case, then I think it's safe to assume that PTI (or more specifically Code Sniffer) is attempting to run Zend Studio's PHP engine when it "sniffs" the code. Am I understanding this correct?

Anyway, I'm not sure what I did by setting DYLD_LIBRARY_PATH in the command line.. What was that supposed to do? You told me to "run Zend Studio's PHP." But what does that even mean? haha.. Sorry about the 20 questions! Just trying to get a firmer grasp on this stuff..

And thanks by the way!!

User avatar
rbzend
Zend Global Support
Posts: 536
Joined: Tue Dec 23, 2008 5:03 pm

Re: PTI (PHP Tool Integration) Questions..

Post by rbzend » Tue Nov 09, 2010 12:11 pm

mmmshuddup wrote:... PTI (or more specifically Code Sniffer) is attempting to run Zend Studio's PHP engine when it "sniffs" the code. Am I understanding this correct?
I'm not familiar with PTI, so I can't confirm this. But most probably, your version is not completely correct. To use the built-in PHP binaries from the Zend plugin, PTI (CodeSniffer) needs to know about them. If the location of the PHP binaries is configurable in PTI, then you're probably right. But I don't think that this can happen automatically.
I'm not sure what I did by setting DYLD_LIBRARY_PATH in the command line
DYLD_LIBRARY_PATH is an environment variable that instructs the program (php-cgi) to use the specified path to search for the shared libraries, instead of the default location (/usr/local/zend/lib). You probably must configure this in PTI somehow.
Roman Basayev
Rogue Wave Support
https://support.roguewave.com/

mmmshuddup
Posts: 28
Joined: Fri Oct 22, 2010 6:44 am

Re: PTI (PHP Tool Integration) Questions..

Post by mmmshuddup » Sat Nov 13, 2010 1:59 am

DYLD_LIBRARY_PATH is an environment variable that instructs the program (php-cgi) to use the specified path to search for the shared libraries, instead of the default location (/usr/local/zend/lib). You probably must configure this in PTI somehow.
To use the built-in PHP binaries from the Zend plugin, PTI (CodeSniffer) needs to know about them. If the location of the PHP binaries is configurable in PTI, then you're probably right. But I don't think that this can happen automatically.
Ok, well I've attached snapshot of the PTI preferences inside ZS (Zend Studio -> Preferences.. -> PHP Tools -> PHP CodeSniffer).
Screen shot 2010-11-12 at 6.51.05 PM.png
Screenshot of PTI settings
Screen shot 2010-11-12 at 6.51.05 PM.png (122.52 KiB) Viewed 8070 times


There is a drop down menu for selecting which PHP version to run but there are no paths showing where it gets them from. You can see so in the second screenshot I've attached.
Screen shot 2010-11-12 at 6.54.04 PM.png
Selecting PHP in the PTI settings
Screen shot 2010-11-12 at 6.54.04 PM.png (121.35 KiB) Viewed 8070 times
Just to be clear, though, I have already attempted to select PHP 5.2.14 (CGI) and that didn't fix the error it spat out that we talked about before.

mmmshuddup
Posts: 28
Joined: Fri Oct 22, 2010 6:44 am

SOLVED

Post by mmmshuddup » Sat Nov 27, 2010 10:25 am

@rbzend
I never got a response again from this as it sort of naturally fell onto the backburner with more recent topics taking precedence. But I did want to inform you that this magically solved itself when I installed Zend Server CE. You guys did this on purpose, didn't you? C'mon...be honest. LOL jk. Who knows how or why but I imagine it's because Zend Server installs in more of a standard linux-style directory (as opposed to MAMP) and I'm sure PTI was configured to automagically look for those paths first. Just a guess!

Thanks again for all your help though in attempting to troubleshoot this earlier!

User avatar
rbzend
Zend Global Support
Posts: 536
Joined: Tue Dec 23, 2008 5:03 pm

Re: PTI (PHP Tool Integration) Questions..

Post by rbzend » Tue Nov 30, 2010 2:34 pm

No wonders here. Zend Server installs the libraries at the location where Zend Studio's PHP is looking for them by default (again, due to the way we build it on MacOS).
Roman Basayev
Rogue Wave Support
https://support.roguewave.com/

supajan
Posts: 1
Joined: Tue Apr 05, 2011 7:59 am

Re: PTI (PHP Tool Integration) Questions..

Post by supajan » Tue Apr 05, 2011 8:04 am

I've had the same problem, even I already installed Zend Server CE (but before I installed Zend Studio 8).

I have solved the problem by adding my own PHP Executable to Zend Studio and use it for CodeSniffer. I used the Executable from ZendServer CE, but I guess you can also use the PHP Executable of any other package like MAMP oder self compiled...
Bildschirmfoto 2011-04-05 um 08.59.26.png
Bildschirmfoto 2011-04-05 um 08.59.26.png (162.09 KiB) Viewed 7459 times

Post Reply