locked
Use PHP site with EW 4 RRS feed

  • Question

  • I have a site that was built using Sitebuilder.  I have decided to port this to my local computer and use EW 4 to make changes to it.  The files generated by Sitebuilder are all PHP files.  If I download the PHP VC6 x86 Thread Safe zip file, is that all I need to be able to make changes and preview the site?  Do I need the installer?  Do I need to download Apache?
    Monday, August 2, 2010 12:19 AM

Answers

  • Hallelujah!!!!  I got it working!!!  How???  That is my little secret :) Just kidding!!

    Follow the directions at this link exactly.  I used VC9 x86 Non Thread Safe.  I believe step 4 may have been the downfall.  No other instructions recommended this.  These instructions need to be put in Expressions Web rather than the ones that are there.

    http://expression.microsoft.com/en-us/ee662148.aspx

    • Marked as answer by LadyGeek Monday, August 2, 2010 6:43 PM
    Monday, August 2, 2010 4:45 PM

All replies

  • You can use EW 4 to change and edit your php website. You don't need to download anything assuming you have the source files for your site. EW 4 has a php server included that will let you preview your site. You could also publish it to your server with a slightly different name like index_test.php and preview it online by putting that name on the end of your browser's url.
    Monday, August 2, 2010 12:44 AM
  • She needs to install the PHP executable and point EW to it under Site > Site Settings > Preview tab.

    Sitebuilder sites frequently make reference to files that are on some central hosted sever so publishing to your local site may not get them all. It didn't on one I made from a hosting company's site builder as a test. I ended up rebuilding it from scratch and pulling the content from the web because it was held in some database I didn't have access to on the host's backend.


    MS MVP Expression Tutorials & Help http://by-expression.com
    Monday, August 2, 2010 1:15 AM
  • I installed PHP VC6 x86 Thread Safe and changed the name of the ini developer file and pointed to the php executable.  Now when I preview, it comes up with a blank IE screen.  When I open the .php file in EW, it opens fine.  I just can't preview it.
    Monday, August 2, 2010 1:23 AM
  • Did you set your Site Preview options to use the development server for PHP pages?

    (If you have a mix of HTML and PHP pages, set it to use the development server for all pages so that you can click a link from an HTML page to a PHP page while previewing.)

    Did you tell EW where your PHP executable was?  See Tools -> Application Options -> General tab, PHP path.

     

     If all of the above check out, try a trivial page:

    <?php
    echo "Hello World";
    ?>
    Or, check your installation with: <?php phpinfo(); ?>
    Monday, August 2, 2010 1:37 AM
  • I do not see any log files.  Does Apache have to be installed? 
    Monday, August 2, 2010 1:40 AM
  • No, apache does not have to be installed.  EW's development server can run PHP.  But see my other reply for things to check.
    Monday, August 2, 2010 1:43 AM
  • The  Site Preview options to use the development server for PHP pages have been set.  When I tried your example, I saved the file as default.php and the preview showed the actual code:

    <?php
    echo "Hello World";
    ?>
    

     

    The users guide says:

    1. Open the PHP folder. Locate and then make a copy of the "PHP.INI-recommended" file by right-clicking the file and clicking Copy, and then right-clicking inside the folder and clicking Paste.

    2. Rename the file named "PHP-Copy.INI-recommended" to "PHP.INI".

    But there is no "recommended" so I used the "developer" one.

    Monday, August 2, 2010 1:47 AM
  • Did you try the second php page I suggested, to check your PHP installation?

    Also, what is the URL when you preview default.php?

    It should be something like http://localhost:nnnnn/default.php where nnnnn varies. 

    Monday, August 2, 2010 1:57 AM
  • "But there is no "recommended" so I used the "developer" one."

    I have no idea what's in that.

    Monday, August 2, 2010 2:04 AM
  •  

      THe URL is exactly as you say:  localhost:nnnnn/default.php.

     

    I remembered that when I first did this, I got an error that the php.ini file was not configured correctly, did I want Expression web to configure the file and I said yes.

    So I copied the developer ini back again and I get that same message with the first test you suggested but with the second, I get this message

    Server Error in '/' Application.
    --------------------------------------------------------------------------------
    
    HTTP Error 500 - Internal Server Error. 
    
    --------------------------------------------------------------------------------
    
    Security Alert! The PHP CGI cannot be accessed directly.
    
    
    This PHP CGI binary was compiled with force-cgi-redirect enabled. This
    means that a page will only be served up if the REDIRECT_STATUS CGI variable is
    set, e.g. via an Apache Action directive.
    
    
    
    For more information as to why this behaviour exists, see the manual page for CGI security.
    
    
    
    For more information about changing this behaviour or re-enabling this webserver,
    consult the installation file that came with this distribution, or visit 
    the manual page.
    
    
    
    
    --------------------------------------------------------------------------------
    
    Version Information: Microsoft Expression Development Server 4.0.0.0 
    Monday, August 2, 2010 2:14 AM
  • You need to make the changes based on that error message.

    You want to disable force-cgi-redirect.  You should have

    cgi.force_redirect = 0 in a couple places.

    Monday, August 2, 2010 2:23 AM
  • Changed the php.ini file from the "recommended" in this way:

    enable_dl = Off

     cgi.force_redirect = 0

    fastcgi.impersonate = 1

    When I preview the test php, nothing in displayed in the browser. 

    I created a test php file outside of EW and placed in in inetpub/wwwroot and it displays correctly.

    Monday, August 2, 2010 12:21 PM
  • Are you trying to use a custom url aka IIS or are you using the included dev server. To get the Cassini (dev server) to preview you must use "preview in browser" from within EW. You cannot access the Cassini server using a direct url like you can with IIS.
    MS MVP Expression Tutorials & Help http://by-expression.com
    Monday, August 2, 2010 2:37 PM
  • I am trying to use the developer server.  I am using Preview in Browser.  When I am in EW, it indicates that it is using Microsoft Expressions Development Server when I attempt to preview.

    I also installed IIS and put a test file in  inetpub/wwwroot to make sure that PHP was installed correctly which apparently it is. 

    Where does it look for the php.ini file?

    • Edited by LadyGeek Monday, August 2, 2010 2:51 PM
    Monday, August 2, 2010 2:48 PM
  • This is crazy.  When i open EW and then attempt to run the test file with: <?php phpinfo(); ?> in it I get the error mentioned above about the REDIRECT_STATUS CGI using Version Information: Microsoft Expression Development Server 4.0.0.0 . In the c:\php\php.ini file has the following changes from the recommended file:

    enable_dl = Off

     cgi.force_redirect = 0

    fastcgi.impersonate = 1

    The site settings uses:

    C:\php\php-cgi.exe

    When I run it a second time, it just brings up a blank browser.  The URL is always http://localhost:nnnnn/default.php where nnnnn varies. 

    • Marked as answer by LadyGeek Monday, August 2, 2010 6:43 PM
    • Unmarked as answer by LadyGeek Monday, August 2, 2010 6:43 PM
    • Marked as answer by LadyGeek Monday, August 2, 2010 6:43 PM
    • Unmarked as answer by LadyGeek Monday, August 2, 2010 6:44 PM
    Monday, August 2, 2010 3:06 PM
  • I can't help because I used the Web Platform installer to configure PHP, MySQL and MS SQL Express. I then instructed EW where the php executable is in Tools > Application Options > General tab which in my case is located at C:\Program Files (x86)\PHP\php-cgi.exe

    Information on Previewing using PHP and configuring the dev server to use php is in the help file under Previewing Pages > Previeing a PHP Page.


    MS MVP Expression Tutorials & Help http://by-expression.com
    Monday, August 2, 2010 3:56 PM
  • Hallelujah!!!!  I got it working!!!  How???  That is my little secret :) Just kidding!!

    Follow the directions at this link exactly.  I used VC9 x86 Non Thread Safe.  I believe step 4 may have been the downfall.  No other instructions recommended this.  These instructions need to be put in Expressions Web rather than the ones that are there.

    http://expression.microsoft.com/en-us/ee662148.aspx

    • Marked as answer by LadyGeek Monday, August 2, 2010 6:43 PM
    Monday, August 2, 2010 4:45 PM
  • I know you have it working now, but just a comment:

    "cgi.force_redirect = 0" - this occurs more than once in the .ini file, and you needed to change both.

    Monday, August 2, 2010 5:31 PM
  • Sadly MS SQL server is not on the list of favored SQL servers from the point of view of phpBB. So we would have to install yet another SQL server such as MySQL on Windows to support phpBB.

    My Linux box has the standard LAMP stack. There are no surprises, everything works fine with 3rd party packages. The LAMP stack is consider the least common denominator.

    Of course there are alternatives and phpBB can even use Oracle if you have a license. MySQL is free so its part of the main software stack.

    This stack can be installed in Windows but its not the same as the Linux experience. The port is very poor but we applaud the developers who toiled in the attempt.

    All I know is pages in the LAMP stack work as expected. This leaves the developer to figure out how to implement tricky stuff when they do not work.

     

     


    Vote if answered or helpful, I am running for Office (joke)! IT/Developer, Windows/Linux/Mainframe I also am a true vegan and I am very good with economics and I used to play chess at 2400++
    Who are you talking to and what does this have to do with the OP's issue.  Let me answer that for you, nothing.  Don't tack on your rantings onto someone else's thread where they're trying to get a problem resolved - very rude.

    --
    Chris Hanscom - Microsoft MVP
    On Facebook | On Twitter | Resource Center | Veign's Blog | Web Development Help

    Get a Complete Website Analysis by Veign
    Monday, August 2, 2010 5:48 PM
  • Vegan lives in an alternate universe. His posts are coded messages to his agents on earth. Viewed in that context they make more sense.
    Monday, August 2, 2010 5:51 PM
  • Vegan lives in an alternate universe. His posts are coded messages to his agents on earth. Viewed in that context they make more sense.
    Occams Razor - it must be the answer...

    --
    Chris Hanscom - Microsoft MVP
    On Facebook | On Twitter | Resource Center | Veign's Blog | Web Development Help

    Get a Complete Website Analysis by Veign
    Monday, August 2, 2010 5:55 PM
  • I searched the file and only found it one time.
    Monday, August 2, 2010 6:41 PM
  • I appreciate seeing what worked for LadyGeek and the link to the MS instructions, but I'm still not totally clear on VC6 vs. VC9 and thread-safe vs. non-thread-safe.  The MS instructions say to download the latest installer without mentioning which one of the four. 

    LadyGeek said that she got PHP working within her EW4 when she used the VC9 version.  And I can see from the MS instructions that one installer screen image shows IIS FastCGI listed, so I'm guessing that implies MS wants us to use the VC9 version (since I assume the VC9 is targeted to ISS vs. VC6 is targeted for Apache).  So that sounds good for me, but just let me ask this dumb questions:  Should the answer be different for me given that my PHP code will ultimately be deployed sometimes on a Linux/Apache server and sometimes on a Windows/ISS server?

    I see LadyGeek got the non-thread-safe (NTS) version to work, but I didn't see any explicit advice about whether thread-safe (TS) or non-thread-safe (NTS) is preferable.  Maybe it doesn't make any difference?  From the names, it sounds like the TS is supposed to be "safer" in some way, and the NTS is supposed to perform faster, but I'm not clear which is best for use in EW4 on my personal wintel PC where speed isn't an issue and normally something 'safer' would sound appealing.  Maybe it just doesn't really matter whether I pick TS or NTS?

    Thanks,

    Craig in NJ

     

    Friday, August 6, 2010 9:35 PM
  • Differences:

    http://www.iis-aid.com/articles/my_word/difference_between_php_thread_safe_and_non_thread_safe_binaries

    (It's unlikely to really matter previewing a local site on your PC.)

    Friday, August 6, 2010 10:39 PM