X

An Oracle blog about NetBeans for PHP

Install Apache on Windows Vista

This night I have tried to install Apache and PHP on a Windows machine with Vista. I thought that it will take just few minutes as it usually takes on Ubuntu, but it was not. I wanted to install the Apache to the default location (C:\\Program Files/Apache Software Foundation/Apache...). The reason for this was that NetBeans is looking in the default instalation location and if exists, then it offers in new project wizards etc.

So I downloaded the msi installer of Apache and run it. The installation executed nice and correctly. The Apache was running and the url http://localhost shows known page It works! .

But when I tried to copy a file to the document root or create the project from NetBeans inside document root, then it failed. OK, it will be due to a rights permitions, I thouhgt. I noticed that htdocs folder is marked as read only. I opened the folder properties and uncheck the Read Only checkbox. Windows displayed nice progress bar that showed the progress of setting read only attribute to false for all files in the folder as fell. So I tried to copy a file into htdocs folder. It failed! The folder was still marked as read only. Hmmm, strange Windows didn't inform me that the previous action failed. So I tried to change the read only attribute for Program Files and all subfolders in Apache folder. The  same result. Still were read only, even that Windows showed the progress bar, no failed message.

Now was the time to use Google:). It was surprising for me that many people had exactly the same problem as I. Some of them give up and recommend to install back Windows XP. But then I have found the solution. On Molecular Sieve blog is an entry with steps how to solve the problem. Big thanks to author for this.

After applying the steps I can copy files and create project in the document root of Apache, which is installed in the default location.  Still the folders are marked read only, but write in the folder is possible :).

During this exercise I found a few interesting information. Like that the msi installers install the applications as SYSTEM user, which is something like root user in linux. After the installatin the Apache is running with all priviliges as SYSTEM user has and the php and other cgi scripts has also rights of SYSTEM user. Is not very save to expose such Apache publicly. You can find at internet steps how to solve it.

What is your experience with running Apache, XAMP under Vista?

Join the discussion

Comments ( 11 )
  • Kevin Thursday, October 23, 2008

    Hi Petr,

    I use wamp (http://www.wampserver.com/) - this seems to work fine for me - I don't have any read-only problems.

    -Kevin


  • Scott Thursday, October 23, 2008

    Hey all,

    I am with Kevin on this issue. I have an Acer laptop that came with XP and was Vista "READY" then I upgraded to Vista ...still have issues with video but have had no problems with WAMP or the New WampServer for my local Apache PHP MySql testing/development.


  • Ali B. Thursday, October 23, 2008

    WAMP++

    It's simple, fast and much more user friendly than XAMP. And it "just works" :)


  • Jacob Christophesen Thursday, October 23, 2008

    I used wamp.... really quick and easy.


  • Josh Monday, October 27, 2008

    I personally use an Ubuntu (Server>JeOS) virtual machine inside VirtualBox and a samba share mounted as my Eclipse working directory; it tends to give me a lot more power overall.

    I think your real problem here is file permissions; programs are not meant to write user files to %PROGRAMFILES%, it's kind of like using /usr/bin as your tmp directory. In Vista in particular, writing to program files is something of a 'soft fail'; the files get written to a temporary directory and exposed to the program that wrote them there, but aren't actually in the right place on the filesystem. I think it's a hidden folder called LocalStore or similar inside USER\\AppData. It's all part of the backwards-compatibility so as not to break apps that need to write to Program Files, but doesn't take into account when an app (Apache) needs to read files written to Program Files by another app (Netbeans?), as each has its seperate "virtual" Program Files tmp.

    Have a read on some Vista UAC / file permissions for more info.


  • Petr Pisl Tuesday, October 28, 2008

    Thanks to all for your comment.

    Yes, I could use WAMP, but I didn't wanted. I want to use just Apache. And the problem is that the Apache installer suggest the default location in the Program Files.

    I'm now in Germany on International PHP conference and I have talked about this with a guy from Microsoft. He said that he is able to fix it (the apache installer). So we will see.


  • Enkrs Tuesday, November 4, 2008

    I also tried getting Apache/Mysql/Php run on Vista, but it was pretty complicated with.

    In the end, even after I got it working, I installed Microsoft VirtualPC with Ubuntu server (apache,mysql,php,samba) on that. I have setup the VM to take 96MB RAM, and it works fine. Plus under Linux, you can test the PHP project better, having control over file permissions and other stuff.

    Good thing that NetBeans works great with Windows shares.


  • vb Friday, November 7, 2008

    The problem is that you installed into c:\\Program Files which is a protected directory under Vista where only admins are allowed to write to (even if you're running as an admin user, you're usually running in standard mode and won't be able to write there, you get admin mode with installers after the "Are you sure?" UAC prompt), and it will cause all sorts of permissions problems. There are no problems with WAMP because it does not install to c:\\Program Files.

    You would not have any sort of permission problems with regular Apache also if you didn't install to c:\\Program Files


  • Petr Monday, November 10, 2008

    To vb: Sure you are right. IMHO the Apache installer shouldn't suggest the c:\\Program Files as the default location on Vista.

    Thanks,

    Petr


  • frezno Wednesday, November 25, 2009

    I ran into the same problem(s) with Apache etc. installed under the default c:\\program files directory (using Zend Server though).

    The solution i came up with is what vb already mentioned.

    DO NOT install it into c:\\program files but use a directory outside (in my case i choose c:\\zend) and it'll work.


  • Ivan B Wednesday, February 24, 2010

    I use WAMP server and it works very well on my Windows 7 64bit PC.

    Here's some very useful article (that I have used myself) about setting it up to work with PEAR and MDB2 libraries under most versions of Windows:

    http://www.truecms.net.au/blog/mdb2/installing-pear-mdb2-wamp-server-windows-7-vista-xp-32-64-bit


Please enter your name.Please provide a valid email address.Please enter a comment.CAPTCHA challenge response provided was incorrect. Please try again.