jscholl Posted September 6, 2017 Share Posted September 6, 2017 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 Quote Link to comment Share on other sites More sharing options...
benanamen Posted September 6, 2017 Share Posted September 6, 2017 Php by default is not going to execute in a .html file. Change the extension to .php Quote Link to comment Share on other sites More sharing options...
jscholl Posted September 6, 2017 Author Share Posted September 6, 2017 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. Quote Link to comment Share on other sites More sharing options...
Psycho Posted September 6, 2017 Share Posted September 6, 2017 (edited) 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 September 6, 2017 by Psycho Quote Link to comment Share on other sites More sharing options...
jscholl Posted September 7, 2017 Author Share Posted September 7, 2017 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. Quote Link to comment Share on other sites More sharing options...
Sepodati Posted September 7, 2017 Share Posted September 7, 2017 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? Quote Link to comment Share on other sites More sharing options...
Barand Posted September 7, 2017 Share Posted September 7, 2017 ... or <?php phpinfo() ?> Quote Link to comment Share on other sites More sharing options...
Sepodati Posted September 7, 2017 Share Posted September 7, 2017 ... or <?php phpinfo() ?> Yes, that's better. Quote Link to comment Share on other sites More sharing options...
mac_gyver Posted September 7, 2017 Share Posted September 7, 2017 (edited) 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 September 7, 2017 by mac_gyver Quote Link to comment Share on other sites More sharing options...
hyster Posted September 7, 2017 Share Posted September 7, 2017 (edited) 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 September 7, 2017 by hyster Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.