How to execute PHP code on existing html page?

The way to execute PHP on a .html page is to modify your .htaccess file. This file may be hidden, so depending upon your FTP program you may have to modify some settings to see it. Then you just need to add this line for .html:

AddType application/x-httpd-php .html

If you only plan on including the PHP on one page, it is better to setup this way:
<Files abc.html>
AddType application/x-httpd-php .html
This code will only make the PHP executable on the abc.html file, and not on all of your html pages.

How to configure a basic php application on amazon ec2

The most important thing is you need your valid amazon login details

Login with the credentials and you will land on the home screen, dont get confused with various options to setup working php mysql application you need a few options.

The first most important thing is to generate a ssh key and import in the console A good guide on how to generate can be found HERE

Once imported name the key you can remember say php or mykey etc I use php.

Next you can go to Elastic Beanstalk section, select launch new environment.

Choose the required parameters the most important is container type

Select the one which suits you for your php mysql I selected 32 bit amazon linux running php 5.3

Check the parameters for most of columns dont change any but to keep the default one

After filling all the details your environment is can be seen on the same screen, wait for the color or environment to change to green which indicates ALL IS WELL…

You are now almost 50% done till this step.

Go to environment url to check the sample code working, some welcome app or sample application screen

If not then there is something wrong and you can check the environment logs or events to check status.

Next go to EC2 section and your newly created instance is waiting for you.

Its now time to access the newly created instance to upload some files.

Allocate one Elastic Ip from the EC2->Elastic IP section to your instance.

In the instance details you can now see the IP allocated. Just to confirm type that IP address in browser and you should see the same app page that was there while checking the environment url.

Next step is set up putty to access the instance.

Convert the generated key in first step to PPK (Putty Private Key) format. An illustrative guide can be found HERE.

For a Quick revision we followed steps as

  1. Generated key pair
  2. Created instance with default environment
  3.  Imported keys to ec2  environment
  4.  Edited instance to allocate the IP to allow SSH
Next step is to actually ssh your newly created instanceGo to instance section under EC2->instances and click on your instance and note down the elastic IP associated.
Now Open the Puty for SSH connection
In connection details put your elastic IP and under SSH -> Auth section browse the ppk file you created.
When prompted enter user name as ec2-user and password as what you selected while creating your key.


If  ALL IS WELL you can see the favorite black screen for linux console.. Its now your play ground.. and now time to do some settings.
Check for php version and apache version for curiosity, Its not necessary but to start with or to brush your knowledge if you are accessing it after long time like me.
The default apache location is /etc/httpd/
and default webroot will be /var/www/html
Edit some files or create a new one..using VI editor and check on front end..

ApacheSolr Configuration in Ubuntu for Drupal

NOTE:  For installing Apache Solr with Drupal on a Windows machine, pls use following link for the setup; instead of the instructions below. Also see the comments on this link, if you face any issues.

Installing Tomcat
sudo apt-get install tomcat7 tomcat7-admin tomcat7-common tomcat7-user tomcat7-docs tomcat7-examples

Start tomcat by typing
  sudo /etc/init.d/tomcat7 start

Security (Not required if installing on same machine)
If you are using ip-tables and installing Apache Solr on an external server,
modify or add the following line to accept the port 8080
-A INPUT -p tcp -m tcp –dport 8080 -j ACCEPT

After installation type http://localhost:8080 or http://serverip:8080 in your browser.Now you should see tomcat welcome page.

Install Solr
(Check for latest version or nightly build on or

unzip apache-solr-1.4.1.tgz
       tar -zxvf apache-solr-1.4.1.tgz

Linking tomcat7 with Apache Solr application

mkdir /usr/share/tomcat7/webapps

This should give you an idea on where your distribution installed tomcat7.
Attention : If your path is different do not forget to also adjust this in the next steps. whereis tomcat7

should show you tomcat7: /etc/tomcat7 /usr/share/tomcat7

copy the war file to the webapps directory

sudo cp apache-solr-1.4.1/dist/apache-solr-1.4.1.war /usr/share/tomcat7/webapps/solr.war

copy the example solr application to a new directory called solr. We will change this example solr application later on to be viable for Drupal 6

sudo cp -R apache-solr-1.4.0/example/solr/ /usr/share/tomcat7/solr/
create our config file
 sudo nano /etc/tomcat7/Catalina/localhost/solr.xml
And fill it with the following configuration :
 <Context docBase="/usr/share/tomcat7/webapps/solr.war" debug="0" privileged="true" allowLinking="true" crossContext="true">
  <Environment name="solr/home" type="java.lang.String" value="/usr/share/tomcat7/solr" override="true" />
Managing tomcat7 application
 We want to see how and/or if our Solr application is running, we can do this by using the manager application. By default you don't have access to this application so we have to modify the permissions.
     sudo nano /etc/tomcat7/tomcat-users.xml

And modify it so it more or less reflects the same information as shown here.

  <role rolename="admin"/>
  <role rolename="manager"/>
  <user username="nick" password="ateneatech" roles="admin,manager"/>
Drop Tomcat security so Solr can access /usr/share/tomcat7/solr
          sudo nano /etc/default/tomcat7
And modify it so our security is disabled. Be careful if you are running on a server which you do not control 100%!
restart our tomcat service
       sudo /etc/init.d/tomcat7 restart

surf to http://localhost:8080/manager/ and log in with your username and password from above and check if the solr instance is started. If not start and it and check wether or not you receive an error code!
If your application is started, surf to http://localhost:8080/solr/admin and you should see a nice screen!

Linking Drupal 6 with a running Apache Solr
Perform this step if you do not have apache-solr module already enabled i.e. you are adding apache-solr to your app for the first time:

I assume you have Drush installed so we continue with downloading the apachesolr module. Execute this commando in the designated website.
drush dl apachesolr

Perform following steps for all installations of apache solr:
 let's copy our schema that will customize our Apache Solr Instance so it fits the "Drupal" bill.
 sudo cp apachesolr/schema.xml /usr/share/tomcat7/solr/conf/schema.xml

 sudo cp apachesolr/solrconfig.xml /usr/share/tomcat7/solr/conf/solrconfig.xml

Tip: it might be a good idea to use symbolic links so we can easily update our modules and update our schemes if they change …you never know with open source 😉

Additional : give the folder permissions!
 sudo chown -R tomcat7:root /usr/share/tomcat7/solr/

Enable the module in the modules list and go to the config screen fill in the next parameters:

Host name of your Solr server, e.g. localhost or IP Address or
Solr host name: localhost

Port on which the Solr server listens. Tomcat is 8080 by default.
Solr port: 8080

Path that identifies the Solr request handler to be used.
Solr path: solr

On saving these settings, message “Your site has contacted Apache Solr” will be displayed.
You can now start indexing the existing content on your site using cron and check the amount of indexing done at “admin/settings/apachesolr/index”