21

I know this question may have appeared few times here and in the internet. But still I feel it is not clear for somebody who wanted to enter into the world of frameworks. I have followed these links Rob Allens Tutorial, ZF Quick Tutorial.

But some how I feel it is not quite clear with the installation part. I have a windows system basically Vista with the newest version of XAMPP installed. I have downloaded the latest version of ZFSkeletonApplication from this link ZFSkeletonApp, extracted the skeleton contents, renamed the folder to zendframework and moved it to xampp folder i.e now ZF skeleton is in c:\xampp\zendframework.

So until here everything seems clear and easy, from here I am some how lost with the configurations. Can some one elaborate the things from here how to install the Zf and make it work, like changes in the include paths, .htaccess files and so on. Please do remember that I have windows with XAMPP on it. If some one can guide me exactly for this set up, it would be helpful.

P.S. It would be good if one can provide info about the changes which I need to make with examples consisting of paths, so that I am not lost, for example like you can find .htaccess file here(ex pathname), changes in .htaccess file should be so and so.

Thanks

125369
  • 3,547
  • 20
  • 52
  • 70

4 Answers4

18

For future references, i also made a big post on how to install ZF2 on a windows xampp environment right here Install ZF2 on Windows Xampp

OK, i have done this on multiple systems now. For a home system the following steps work quite well:

  • Download msysGit and install it to any directory
  • Run the git-cmd.bat from the msysGit-Folder
  • Move into the directory you want i.e. C:\xampp\htdocs\ (this is done via cd dirname or cd .. to go up a level, change partition with D: and hit enter)

Run the following command. The <OptionalFolderName> would be the name of a Sub-Directory of htdocs, if you skip this, the folder will get named ZendSkeletonApplication

git clone git://github.com/zendframework/ZendSkeletonApplication.git <OptionalFolderName>

Possible Trouble Scenario (fatal:unable to connect to github.com)

Once again at workplaces, pretty often the default port (9418) for the git-protocol is blocked. If this is the case for you, then you should try one of the following Commands

git clone https://github.com/zendframework/ZendSkeletonApplication.git <OptionalFolderName>
git clone git@github.com:zendframework/ZendSkeletonApplication.git <OptionalFolderName>

Now you are not done yet. The skeleton Application is installed, but the framework is still missing, here some people might run into the first problems, but this actually is quite easy.

We're still at the command line interface

  • cd <OptionalFolderName> or cd ZendSkeletonApplication depending on what you did earlier
  • php composer.phar self-update
  • php composer.phar install (this might take a while)

So, this is the part where lots of things can happen. I have two scenarios happened to me:

Scenario #1 No directory write permissions

This is easily handled by running the command line interface with administrator privileges

Scenario #2 Working behind a router (i.e. at work)

Personally i didn't have to do much to get this working, but the line might change depending on your proxy. Personally i did the following at the command line interface

  • SET HTTP_PROXY=http://proxy.domain.tld:8080 you might also be good with
  • SET HTTP_PROXY=proxy.domain.tld:8080 don't ask me why, but i needed the http://

With all those done, you should have an almost running ZendSkeletonApplication. The other part is how to set up your virtual host, but i won't go into detail on this, as that's even ZF1 Stuff and everyone should be familiar with that by now, if not, there's good resources to learn out there.

I hope i could be of help to you.

Sam
  • 16,435
  • 6
  • 55
  • 89
  • Hi Sam,thanks for your reply. I have perfectly followed your instructions until I encountered 'php composer.phar self-update'. In my cmd I am trying this C:\xampp\ZendSkeletonApplication> php composer.phar self-update, which gives me the error that the 'php' word is not found or is written false. It is the same with php composer.phar install command as well. Any reasons why this is happening. All the xampp installation is in C:\xampp and inside that the ZendSkeletonApplication is installed i.e C:\xampp\ZendSkeletonApplication – 125369 Jul 20 '12 at 08:44
  • Ok, two things here. First, i may be mistaken, but every accessible files should be under `C:\xampp\htdocs`. Second as for the php command not being found you may need to add `C:\xampp\php` to your environment variables. You find informatin on how to do that right there > http://php.net/manual/en/faq.installation.php#faq.installation.addtopath – Sam Jul 20 '12 at 09:31
  • Did you manage to get it working? If not on what point are you? If yes, accepting would be good ;) – Sam Jul 23 '12 at 10:03
  • Hi Sam, thanks for following up, I followed your comments, but Im still struck with the php error. I have included the php path in my environment variable (as mentioned in the link), still it is throwing me the same error. Now as you have mentioned I have moved the ZF folder into `c:\xampp\htdocs` i.e the current path for ZF2 is `c:\xampp\htdocs\ZendSkeletonApplication` and my php folder is in `c:\xampp\php`. After changing the recommend changes by you, I was running this in my cmd `C:\xampp\ZendSkeletonApplication> php composer.phar self-update` as mentioned above throws the same error. – 125369 Jul 23 '12 at 11:10
  • What happens if you run the command `php -v`? PS: i'm highly interested in getting this sorted out, as i feel like writing a "ZF2 101" from a very basic point of view, so all errors that occur, i want to cover ;) You may also ping me at #zftalk.2 @ freenode.net irc – Sam Jul 23 '12 at 14:21
  • hello sam, would you please help me ? I tried to follow your instructions but got some error. heres the link http://stackoverflow.com/questions/19484511/need-some-assistance-for-zf2-installation – user1844626 Oct 21 '13 at 02:09
  • @user1844626 You already got the right hook in your comment section of your thread. Carefully read it and you'll get the drill (wrong directory) – Sam Oct 21 '13 at 05:42
  • I opened F:\xampphtdocszen\composer.phar with cmd.exe (F:\xampphtdocszen>) and typed "php composer.phar self-update" then got "Updating to version a2a70380c14a20b3f611d849eae7342f2e35c763. Downloading: connection... [ErrorException] zlib_decode(): data error self-update" . why is that error ? is it for network connection?(my net is bit slow now). did I do anything wrong in process there? – user1844626 Oct 21 '13 at 23:23
  • @user1844626 Please open a thread here on github with composer tag. This sounds like some composer internal or maybe your appache configuration. But it's nothing i've encountered. You can try running `php composer.phar self-update -vvv`, this may give you some more debugging output that may be useful, i have no clue tho. – Sam Oct 22 '13 at 05:33
  • please see my error(http://stackoverflow.com/questions/19484511/need-some-assistance-for-zf2-installation "see Edit"),have no idea why got this error, my net is ok now though. – user1844626 Oct 24 '13 at 04:24
  • @user1844626 Can you read the error message? Can you at least copy the error message into google? Learn to help yourself please ;) enable openssl in your php.ini... – Sam Oct 24 '13 at 05:10
  • can you check this out : http://stackoverflow.com/questions/27660758/how-do-i-install-zend-2-on-a-hosting-server ? thx – Attila Naghi Dec 26 '14 at 19:27
  • hi sam, after following many incomplete guides, i found yours and now have zend working under xammp. i am now stuck trying to get the zf tool to work. I've added php to my environment variable. as far as i can see, i have zf.php.bat in the folder: C:\xampp\htdocs\ZendSkeletonApplication\vendor\bin i've tried adding this to my php.ini incude_path and a load of other things.. some people suggest editing zf.php.bat… some people say copy it to C:\ i wonder if you could edit your guide to include the steps needed to get as far as "zf show version" - thanks jonathan – jcansell Mar 19 '15 at 11:30
  • @jcansell First off: thanks for your feedback. Second of all I suggest to raise a new question here on SO. Personally I can't help with this as I find zftool to be quite useless :) – Sam Mar 19 '15 at 16:00
  • ah - ok… what do you use instead of zftool ? i was just going to create / rename a copy of the skeleton for each project. i dont want to use any IDE at the moment. – jcansell Mar 25 '15 at 14:45
  • You should use an IDE. It just makes EVERYTHING easier ;) but that's offtopic. I write classes by hand, don't need zftool for that. – Sam Mar 25 '15 at 20:11
  • I had to do this: curl -s https://getcomposer.org/installer | php.exe -- ...before or the file "composer.phar" would not even be there. – Pedro Araujo Jorge May 05 '20 at 17:16
1

Setbacks have to install in Windows, but I ended up finding a solution. From ZF2 to install on windows via git, for this is the only use that simulates msysGit git linux on windows, for it is only access the tutorial: http://zf2.com.br/tutoriais/post/instalando-o-git-no-windows-para-fazer-a-instalacao-do-zf2-somente-no-comando-do-windows-via-composer

1

Since I had lot dependency extension problems (mostly .dll files) with old version of XAMPP, so first thing I did was made sure I uninstall all previous versions of PHP already present on my system as well as old XAMPP. Then installed latest XAMPP v3.2.2 (using latest XAMPP 3.2.2-32-bit on Win-7-64-bit). Then followed installation steps in XAMPP Documentation under title Start a New Zend Framework 2 Project.

I had issues while installing composer also with old-XAMPP, but somehow those errors didn't appear during composer installation this time. And, I successfully installed ZEND till I typed http://localhost:8081/myapp/ (I renamed my ZendSkeletonAppliction folder as myapp as per documentation) into my browser to access the same and met the error which said:

Fatal error: Uncaught RuntimeException: Unable to load ZF2. Run php composer.phar install or define a ZF2_PATH environment variable. in C:\xampp\apps\myapp\htdocs\init_autoloader.php:51
Stack trace:
 #0 C:\xampp\apps\myapp\htdocs\public\index.php(18): require()
 #1 {main} thrown in C:\xampp\apps\myapp\htdocs\init_autoloader.php on line 51

Composer.phar was not even present the first time I downloaded ZendSkeletonApplication‐master.zip from Github (there was only composer.json and composer.lock files present). Anyhow I didn't need them since I followed XAMPP Doc which doesn't call composer.phar in command line:

composer create‐project ‐s dev zendframework/skeleton‐application path/to/install

I am not that tech-savvy to know how to 'define a ZF2_PATH environment variable' correctly, so I wasted time looking for solution online, couldn't find any (which is when I stumbled on this forum which also turned out not to have a solution for my query). In the end, in a fit of depression and anxiety, serendipity happened. All I did was as per XAMPP's ZEND documentation I right-clicked inside C:\xampp\apps\myapp\htdocs folder and clicked 'Composer Install' which reinstalled the Zend files from cache. Then refreshed http://localhost:8081/myapp/ and the Zend intro page appeared.

Donal Fellows
  • 133,037
  • 18
  • 149
  • 215
Guru A S
  • 11
  • 2
0

I just did it like that:

D:\web_dev\zendapp>C:\PHP\php.exe composer.phar self-update

it worked perfectly

j0k
  • 22,600
  • 28
  • 79
  • 90
Theo Walcott
  • 41
  • 1
  • 7