This forum is no longer active. Please post your questions to our new community site

Forums MAMPStack

Howto Get PHP to Execute

Subscribe to Howto Get PHP to Execute 3 post(s), 2 voice(s)

 
Avatar pypo 11 post(s)

I’m a novice trying to run some php from an html file. I’ve been using javascript and html fine so far on this stack. Apache and MySQL are running fine (except that I’m forbidden from using myPHPadmin for some reason TBD.

Anyway, I just want to include an external file in my index.html.

<? include ‘external.html’;?>

The Programming PHP manual says that’s how to do it, but nothing happens. The external.html file is supposed to load an image: (I removed the < > below so the code would show up here)

img src=“external.png” width=“320” height=“300” border=“0” align=“center” alt=“page 2”

This is all just testing stuff. But I need it for a framework. The image loads fine if I just put the the html code in the index.html file. But I cannot make it work using the php include function.

Do I need to do some additional configuration to get PHP running on the WAMP stack?

Thank you.

 
Avatar carlos Administrator 144 post(s)

Hi pypo,

You should put the php code inside files with .php extension. For example, if you write the following code:

<?php 
phpinfo();
?>

inside htdocs/page.html and htdocs/page.php, you will not get any info going to “http://<ip>:<port>/page.html” because php code is not evaluated, but using “http://<ip>:<port>/page.php” will return all php info.

In order to use phpMyAdmin you should be accessing the page from the same machine where the stack was installed, using “administrator” user with the password you configured during installation.

I hope it helps.

Regards

 
Avatar pypo 11 post(s)

Carlos. Your instructions got me moving again. Thanks for taking the time to make it so clear !

Forums MAMPStack