Jump to content

php code not executing from html page


jscholl

Recommended Posts

I am trying to run the following php code in the attached file.  I am attempting to connect to a mssql server to run a query. I receive no error messages but the query dies not work. There is another problem, if I include a line such as:

 

 

 

if( $conn === false") <p>no connection<p>;   all code following the <p> is treated as text. If I omit the <p> nothing is echoed.

 

 

dome2.html

Link to comment
Share on other sites

OK my actual problem is that as far as I can tell my php code is not being executed.  If I try to open a .php file in my web site I get a message it can not be found.

I have php installed on the same computer on which I am running Microsoft IIS Express. All other code than php executes successfully when I open mu website on

another computer in my local network (wifi). Do I have to put the php directory within a particular directory within my web site directory to get it to execute or do I have to configure something IIS Express to get it to execute.

Link to comment
Share on other sites

Yes, there are configurations that need to be made. Basically, it sounds as if all you've done is install the PHP framework that will process PHP pages. But, you have to instruct your web server (IIS) which pages to send to the PHP parser. That is what benanamen was talking about. Typically, a server is only configured to send pages ending with .php to the PHP parser. So a page with the extension .htm or .html will not be sent to the PHP parser and will just be sent directly to the requesting user.

 

Here is a page that purports to instruct how to set up PHP on an IIS server. Use at your own risk.

 

https://docs.microsoft.com/en-us/iis/application-frameworks/install-and-configure-php-on-iis/install-and-configure-php

Link to comment
Share on other sites

I followed the instructions at the link you provided. I want to call a php file that only executes a query. I do not want it to try to display or do anything else. How do I do that?  Every thing I have tried so far in samples on other sites does not work.

Link to comment
Share on other sites

if your goal is to get a web development environment setup, use one of the all in one WAMP packages, such as xampp - https://www.apachefriends.org/index.html this will get you a system with php correctly installed and working with the web server.
 
if you need php to connect to an mssql database server, you need to install an appropriate php extension (see the list of choices at this link - http://php.net/manual/en/intro.mssql.php ). and again, if all you are trying to do is setup a web development environment, the all in one WAMP packages come with a database server.
 
just because you are using windows as your operating system doesn't mean that you must use ms web and database server software.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.