I'm new to Zend and noticed there's something called ZFtool. So I installed it via this tutorial: http://framework.zend.com/manual/2.1/en/modules/zendtool.introduction.html. With some hassle and editting I finally got it to work in my htdocs folder of xampp.
Whenever I now run php vendor/zendframework/zftool/zf.php create project testproject it actually creates a project in my htdocs called testproject. But whenever I now want to add a module I'd have to do php vendor/zendframework/zftool/zf.php create module some_module c:/xampp/htdocs/testproject.
Now; I've got the feeling that this can(or atleast SHOULD) be more efficient than how I'm going at it now. Is there a way I can make the zf.php file universally reachable or anything to make the command line a little easier?
Download zftool.phar from : https://packages.zendframework.com/zftool.phar
Place it on:
C:\bin\zftool.phar
Create zftool.bat on:
C:\bin\zftool.bat
zftool.bat
#ECHO OFF
php "%~dp0zftool.phar" %*
Add this path to your Environment Variable:
Now you are able to use zftool from anywhere in your command prompt like this:
Related
So I have been seeing a lot of this command line stuff to install/update frameworks/modules over the internet but never actually tried to use it. I would just manually copy files.
I am starting to learn how to use Laravel and also trying to learn about all this command line stuff, I downloaded and installed composer and now this is where I'm stuck.
What do I do with a command line like this php artisan bundle:install bob ?? Do I have to copy it in a cmd.exe or copy it in the address bar of my browser.
I cannot find a tutorial which explains just the basic of the basics of using this and am pretty lost.
From the looks of it you're currently using Laravel 3.
I just want to let you know that Laravel 4 is way on it's way and I'd recommend that you have a look at it instead of L3. Here's a link.
As for your question: You need to define the path to your php.exe file.
Open up your start menu and write "Environment". Without the "".
In the first window you'll see a bunch of variables and values. Edit the "path" variable.
Go to the very end of the "value" field. And - if there isn't already one - type a ";". Without the "".
After that paste the path to your php.exe. Just the folder.
I.e:
C:\xampp\php
not
C:\xampp\php\php.exe
And then you're done.
You might have to restart your computer for this to apply though.
I use netbeans 7.2.1 and newest phpunit. When I want to generate a unit test in netbeans by right-clicking on the php class then Tools-> Create phpUnit test the Skeleton generator throws an error: No such file or directory.
require_once(/sharedResources/connection.inc.php): failed to open stream: No such file or directory
The issue is that the path displayed in require_once is wrong. It is generatedliek this:
$sharedResources = getenv("DOCUMENT_ROOT") . "/sharedResources";
and should resolve to the absolute file path. This works fine when application is running in apache. However it seems that getenv("DOCUMENT_ROOT") is just wrong when running from netbeans. My question is how I can set it correctly? My application is under
getenv("DOCUMENT_ROOT") . "/MyApp";
and the file I'm creating a test for is in
"MyApp/services"
Under Project properties there is an option web root but it is greyed out and it is impossible to set it to a folder one level higher than your application.
How can I solve this?
EDIT:
Further clarification:
I initially had a relative filepath to sharedResources which did not work also. the I changed to this one and of coruse ti makes sense it is not working as DOCUMENT_ROOT is set by apache and hence not set when running in netbeans. So a temprary fix is to add
$docRoot = getenv("DOCUMENT_ROOT");
if(empty($docRoot)){
putenv("DOCUMENT_ROOT=C:/xampp/htdocs");
}
to the head of every class. of course that is not a very practical or good solution. I would need to tell netbeans to set this environment variable or to use correct relative path.
Well here is my solution. It's not ideal but simple and works. The issue is that DOCUMENT_ROOT is obviously empty when script is not called by Apache but by netbeans. Hence it must somehow be set. To do that I edited the php file phpunit-skelgen(it does not have a file ending but it's a php file).
Below the license text as first php line I added
putenv("DOCUMENT_ROOT=C:/xampp/htdocs");
That did the trick.
Just started working with the Zend Framework Zf Tool and I've already come across a problem I've spent hours trying to figure out.
For some reason when I run the Zf show version command I get a ZF ERROR indicating it cant find the Zend Framework a to add it to my php.ini include_directory.
Here is my setup. I'm currently have WAMP installed on my local machine.
c:\wamp
I copied the zf.bat and zf.php files into the servers php directory. The path to the php directory has been added to the path environment variable. I'm pretty sure it works because I run the zf show version command in the console and get a ZF ERROR.
I keep my copy of the Zend Framework inside
c:\wamp\includes
So I added this to the php.ini include_path. include_path = ".;c:\wamp\includes"
I checked that this setting was set correctly by checking phpinfo() function. Which shows
include_path .;c:\wamp\includes .;c:\wamp\includes
So I think I have everything setup correctly. I can't work out what I'm missing.
I also tried setting the ZEND_TOOL_INCLUDE_PATH with no success.
Any help would be appreciated. PS I did check other posts here but none of the suggested
I have worked it out! Finally. The way I have my local wamp setup there is 2 php.ini files I have to edit.
The one that made the different is the php.ini inside the Apache2 directory.
Thanks everyone for their help. I appreciate it.
Well im not sure how you downloaded installed the framework but my guess is that you dont have enough of you include path based on the way Zend release packages are constructed. The Zend folder contained in the Zend Framework installation needs its parent folder to be on the include path so typically you would add something like:
c:\wamp\includes\ZF_BASE_DIR\library
This is because the zf package structure looks like:
ZendFramework-VERSION/
README.txt
INSTALL.txt
LICENSE.txt
bin/
library/
If you extracted ZF from the archive you will get a Zend-some_version folder, but the actual ZF is in
"include_path\Zend-some_version\library\Zend", so your include path should point include_path\Zend-some_version\library\
Just to add to what Tjorriemorrie said and to explain in detail how I got my installation on win 7 to work as simply as possible:
Download your preferred Zend package from "http://framework.zend.com/downloads/latest" to "C:\wamp\www\"
unzip your zip file so that you have the extracted Zend folder (with version name) under "C:\wamp\www\".
Rename your folder by removing the version so that you end up with "C:\wamp\www\ZendFramework"
Run a simple php file with phpinfo() in your browser. Note the entries for: "_SERVER["PATH"]" under PHP Variables
"Path" under Environment
"Loaded Configuration File" at the top
"include_path" under Core and
"extension_dir" under Core as well.
"_SERVER["PATH"]" and "Path" must be identical (no brainer)
There should be only one listing for your apache server and that should be the listing under "Loaded Configuration File" but without the "php.ini". So, if your "Loaded Configuration File" is "C:\wamp\bin\apache\apache2.2.22\bin\php.ini" you must have "C:\wamp\bin\apache\apache2.2.22\bin" in your path and that must be the ONLY reference to an apache server. If you have multiple references to apache servers Windows may pick the wrong one depending on your PATH order and use the wrong php.ini file.
Your "extension_dir" will tell you the version and location of php you are using. It is common to have different php folders lying around such as "C:\php", "C:\wamp\bin\php\php5.4.3", "C:\wamp\bin\php\php5.3....", etc. The extension directory will tell you which one of these php folders ZF will "reference" when it is looking for its library. For example, if your extension directory says "c:/wamp/bin/php/php5.4.3/ext/", you want to focus on "c:/wamp/bin/php/php5.4.3"
Go back to your PATH and a) add the string for this php version and b) remove all the other references to the other php folders
Now that you know your running and primary php and apache folders, shutdown (do not restart), shut down your computer and boot back up (restart does not always let the PATH completely reset.
Go to BOTH php.ini files at a) "C:\wamp\bin\apache\apache2.x.y\bin" and "C:\wamp\bin\php\php5.4.3" and find the include_path variable for Windows
Replace the default line, which looks like:
;include_path = ".;c:\php\includes;"
with
include_path = ".;c:\php\includes;C:\wamp\www\ZendFramework\library"
ON BOTH FILES just as Tjorriemorrie notes.
Restart All Services by clicking the wamp icon and selecting said option
At this point my zf tool was working. But, just to be safe, shut down and bootup
Smile and grab a beer!
I'm trying to use Doctrine with Zend, I have copied the doctrine.php and doctrine file in the script folder in the Source Files folder.
However when I type in command prompt following command: "php doctrine.php" by entering in the scripts folder, Nothing happens, there is no error printed, the cursor just goes to next line. Can someone please tell me how can I use doctrine.php.
When using Guilherme's integration suite, you need to do a couple of things.
Download / clone the Doctrine Common, DBAL and ORM libraries and make sure they're available in your include path. For this, I usually just copy the lib/Doctrine code from each into my project's library folder. If using git, you can add them as subtree splits but that's a topic for another time ;-)
You also need the Symfony Console and Yaml namespaces. Again, it's easiest to place them in your project's library folder under library/Symfony/Component/Console and library/Symfony/Component/Yaml. These usually come as submodule dependencies in the Doctrine libraries but you can also get them from their github pages
Console
Yaml
Remove the bootstrap('Config') call from the doctrine.php script. Don't know what Guilherme was thinking there :-)
That's it, from there it should work as expected.
I am moving my first steps with the Zend Framework. I have it on my Linux partition and it works fine. Now, I want to use it on Vista. I have downloaded and installed Zend Server CE. Seems to work.
However, when I try to edit some file inside my Apache htdocs directory, surprise: I have no permissions! I have found out that - despite the fact that I am administrator - the whole Programs folder is read-only! I tried to change this, but without success: it puts it back to read-only as soon as it has finished. What can I do? It is not possible to work like this...
Two things you can try-
1) Run your text editor as an administrator before editing files.
2) Reinstall ZSCE outside of your Programs folder.