Jump to content

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
https://forums.phpfreaks.com/topic/304879-php-code-not-executing-from-html-page/
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.

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

Edited by Psycho

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.

Have you confirmed PHP is working at all? Make a file with just the following in it called info.php and place it in your web directory.

 

<? phpinfo(); ?>
Then load http://localhost/info.php or whatever the path should be. Does that generate a PHP info page?

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.

Edited by mac_gyver

also whats the address u are using ??

locally u should use

localhost/file.php

127.0.0.1/file.php

or the IP address of ur pc.

if its using the local file path (c:\wamp64\www\file.php) it will not work

Edited by hyster
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.