PHP 5.4 and Zend PHP Editor

General discussion on Zend Studio
Post Reply
enoustens
Posts: 1
Joined: Sat Oct 06, 2012 9:43 pm

PHP 5.4 and Zend PHP Editor

Post by enoustens » Sat Oct 06, 2012 9:46 pm

I just finished upgrading to PHP 5.4.7. When I try to use sqlsrv commands they seem to run ok, but the editor doesn't recognize the functions. Any ideas?

totalsupport
Posts: 123
Joined: Thu Aug 20, 2009 2:38 pm

Re: PHP 5.4 and Zend PHP Editor

Post by totalsupport » Thu Oct 11, 2012 10:51 am

sqlsrv isn't part of the 'standard' php installation and the studio can't automagicly detect which extra modules you've loaded on your production environment.

The studio uses language libraries in which it has the function definitions and documentation. In your PHP-project (php explorer) scroll down to "PHP Language library" and open some of the files in the "Core API" folder.

You'll see something like this:

Code: Select all

/**
 * Fetch a stored variable from the cache
 * @link http://www.php.net/manual/en/function.apc-fetch.php
 * @param key mixed <p>
 * The key used to store the value (with
 * apc_store). If an array is passed then each
 * element is fetched and returned.
 * </p>
 * @param success bool[optional] <p>
 * Set to true in success and false in failure.
 * </p>
 * @return mixed The stored variable or array of variables on success; false on failure
 */
function apc_fetch ($key, &$success = null) {}
(a LOT of these actually)
There's only documentation and the function name here. No actual code.

Basically you'll have to find a language library for the sqlsrv-commands, or create it yourself. There aren't that many functions so it's doable (http://php.net/manual/en/book.sqlsrv.php).

Once you have your php-file with the function definitions (and perhaps some documentation) go into your ZS preferences, Go to "php libraries" and add your own 'library' containing this new php-file. Add this library to your project and you now have code recognition/completion (and even documentation if you included it).

Post Reply