created project appears in php dir - zend-framework

I try to create a zf project but the project appears in my php dir.
I use zf version 1.9.2
I have the zf.bat and zf.php copied to:
k:\xampp\php\zf.php and k:\xampp\php\zf.bat
I use windows xp.
But it creates the project in my php dir in stead of in my webroot.
Any idea's?

You have to invoke the command from the folder you want to create the project in. This would look something like:
k:\xampp\htdocs> zf create myproject
In order to be able to use the client script from everywhere in your folder structure you have to add zf.bat to your system path.
If you don't know how to do that I recommend Redmond Path which lets you manage entries in the system paths with ease.

The easiest solution is to copy and the paste the project :) easy isn't ?
What i think is probably the better solution:
Put your php.exe and zf.bat in your path (SYSTEM PATH) so you can execute its command from anywhere you like:
Go to system properties -> advanced tab -> environment variables button ->
then choose the "path" form system variables and add the path to your PHP.exe and ZF.bat
Looks something like this
D:\wamp\bin\php\php5.2.6;D:\Workspace\Zend\ZF\bin;D:\Workspace\Zend\PHPUnit
DONT forget to add the ";" between every executable ! .
once you did this .. and form your webroot dir you can execute any ZF Tool Command you like

Related

Eclipse can't see /usr/local folder on mac

I am developing a web application in Java on my mac.
The web application will run on tomcat.
I have installed tomcat in /usr/local/apache-tomcat.
When I try to set the tomcat runtime in Server->Runtime Environments, I am not able to see the folder /usr/local. how do I get eclipse to see the /usr/local/apache-tomcat directory?
I am able to see /usr/local when using the Go to Folder option in Finder.
I had similar problem with loading external jar files in /usr/local/ for Eclipse on Mac
The way i resolved this was to create a soft-link using ln -s to the folder in /usr/local to a visible folder and then loaded the jars.
ln -s source visible_location/link
Works for me.
I just got a similar problem, and the workaround i found is to copy/paste the path of your tomcat base directory, and it works fine:
Go to your tomcat base directory
pwd to get the path and copy it
Go to eclipse -> preferences -> servers -> runtime environments -> add button -> select apache tomcat version -> then next
At this step, instead of browsing, you can simply paste the copied path in the Tomcat installation directory field!
et voilĂ 
My guess is that you have your finder settings that hide hidden folders. It is possible to show them by following the instructions in this article.
The easiest way to do this is to type the following in your terminal:
defaults write com.apple.finder AppleShowAllFiles TRUE
killall Finder
If you type out the full name of the installation folder instead of using the finder, does it work?
You can easily control hidden files writing this in bash_profile
alias hideOn='defaults write com.apple.finder AppleShowAllFiles TRUE'
alias hideOff='defaults write com.apple.finder AppleShowAllFiles FALSE'
alias kFinder='killAll Finder'
alias hOn='hideOn && kFinder'
alias hOff='hideOff && kFinder'
Then, reopen your terminal and write hOn. At root folder you will see hidden /usr. Just put it in your finder sidebar. Then write hOff and you will stop seeing the hidden files, but /usr will be always there at finder.

PhpStorm PhpUnit via phar autocomplete not working

I have PHPStorm 8.0.1.
PHPUnit is installed via PHAR archive like:
wget https://phar.phpunit.de/phpunit.phar
chmod +x phpunit.phar
sudo mv phpunit.phar /usr/bin/phpunit
PHPUnit works via cli:
user#pc:/usr/bin$ cd ~
user#pc:~$ phpunit --version
PHPUnit 4.3.5 by Sebastian Bergmann.
I followed the instructions from JetBrains website https://www.jetbrains.com/phpstorm/webhelp/enabling-phpunit-support.html#d298258e897
In PHPStorm File->Settings tab PHP/PHPUnit
the radio button Path to phpunit.phar is checked
and value is set to /usr/bin/phpunit
I have a file with a test defined like:
class MyTest extends PHPUnit_Framework_TestCase {
...
At this point PHPStorm marks Undefined class PHPUnit_Framework_TestCase
I've restarted PHPStorm and Computer, but still have the same problem.
I've also tried adding /usr/bin to include path (right click on external libraries in project view, and choose option Configure PHP include paths) without success.
Here's the config for PHPStorm Settings, tab PHP (if it matters):
PHP Language level: 5.5 (finally, generators, etc.)
Interpreter: PHP 5.5 (5.5.9-1ubuntu4.5)
Include path is empty
In order to have a PHAR archive indexed by the IDE it has to have a .phar extension (that's a requirement).
The easiest solution is to place phpunit.phar somewhere in your project (usually it would be PROJECT_ROOT/vendor/ folder).
If having local copy inside the project folder is not desired (for whatever reason; although Composer and other similar kind of tools (bower/npm/etc) are primarily aimed at keeping dependency stuff/packages locally), you may use symbolic links:
either create a symbolic link to that file locally (e.g. PROJECT_ROOT/phpunit.phar --> /usr/bin/phpunit)
or place a full copy (or such symbolic link) in a separate folder outside of the project and then reference it via PhpStorm's Settings | PHP | Include Paths functionality.
The above fix by Calin worked for me too on PhpStorm 2019.1.1, so I'll post it as an answer for easier visibility:
Try right clicking on the .phar and clicking "Exclude phar from project", then clicking "Include phar into project" to refresh it.
In my case, both the .phar file and my .idea folder were pulled from a git commit. I guess PhpStorm didnt realise that the file needed reimporting.
I noticed even though PHP itself can find and run phar that is in its include path, PHPStorm having trouble finding and parsing them.
LazyOne's explanation is correct, however, I didn't need to put it in project folder to be recognized, you can put them in any path as long as its path is introduced to IDE. In my case, I put all phar files in PHP folder, so I just needed to add PHP folder to Include Path list in IDE
Include Path for PHP is under Settings -> Language & Frameworks -> PHP screen (that tiny + at the bottom of screen).

how to install Zend Framework in wamp

I am very new in Zend framework and I want to learn this framework.
So I have downloaded ZendFramework-2.0.5 version but I dont know how can I install it, run it and work on it.
I want to install it into WAMP server , Eclipse IDE and window XP os.
Please tell me all the useful step to achieve it.
Thanks in advanced.
The easiest way to work with a library would be to add it to your php.ini include path, like :
include_path = ".;c:\php\includes;C:\wamp\apps\ZendFramework-2.0.5\library"
I would recommand you to put it in the Apps folder of wamp, this way it's not project specific. The other way would be to put the Zend folder from the bundle in the library folder of a Zend project
To be able to use the ZF tool (create project and a few other things) you also need to add to your environment variables the path to the folder containing the zf.bat command line tool
Terms might differ since I have a french version of Windows, but translation should be accurate enough
right-click on your computer and select properties
Advanced systems settings
Environment variables
In the section Variables for user ..., click on create and name the new variable ZF and set C:\wamp\apps\ZendFramework-2.0.5\bin as the value
In the section System variables find the key path and add the same path at the end (make sure to put a ; before pasting your new path)
Start a command line tool in admin (right-click on icon and select run as administrator) and type zf, you should get the help text from the ZF tool
From there you should be able to create a new project where you want by following the quick start given in the documentation
You might want to create a new virtual host for your project as well
You can then try the follow tutorial (one of the bests)

Install4j create user data directory

Install4j has the system variable sys.docsdir that will create a data directory in the proper place. But I can not find an action to add to the installation that will create an empty directory. What is the action? If I need to create custom script, a sample would be awesome.
The installer variable sys.docsdir contains the path to the user-specific "Documents" folder on Windows, it does not create a directory.
To install files into a subfolder of the sys.docsdir directory, add a new root under Files->Define distribution tree with the name ${installer:sys.docsdir}/myfolder and add the files below that folder.
To install to a folder that is resolved at runtime, the name of the installation root can contain your own installer variable, like ${installer:myDataDir}. In that case, you have to define that variable (for example with a "Set a variable" action) before the "Install files" action runs.
You may find your answer here, in the following link:
http://blog.ej-technologies.com/2010/12/more-installation-options-with.html
Hope it helps you.

Include path of php.ini ignored by Eclipse

I have a PHP script to run. If I run it from the command line, it works fine (include path is set correctly).
If I want to run it inside Eclipse (Run as script), then the PHP include path of my php.ini is replaced by Eclipse, with all the libraries I've added to the project.
I've configured my PHP executable in Eclipse. I've set the correct PHP executable file, and I selected my php.ini file too (the right one, I've checked). But it is ignored...
Edit : this is an Eclipse bug :
https://bugs.eclipse.org/bugs/process_bug.cgi
Wouldn't manually re-adding the old paths using
set_include_path(get_include_path() . PATH_SEPARATOR . $path);
in the first line of the script you're running work?
Could you add the current php include path as a linked folder within your project, in order to reference that linked directory in the PHP include path?
alt text http://files.zend.com/help/PDT/include_path_properties.png
That way, even if your path is replaced, it will be replaced by:
your path
all the other librairies
This is a bug of Eclipse, 3 bugs have been filled about it but none of them got fixed.
No solution without modifying your PHP files.
https://bugs.eclipse.org/bugs/process_bug.cgi
In Eclipse for PHP Cli Applications
1) Click on Project Properties
2) Click on Include Path
3) Add external folder and/or Source and/or Libraries
After doing such I was able able to run my programs. If I didn't do the above I was having to use the function
set_include_path(get_include_path() . PATH_SEPARATOR . "c:\PHP\PEAR"); etc...
For PHP Web applications I wasn't having issue because I put my include_path var in the Apache2 vhosts file along with my configuration.