3

I have just moved to nginx and updated my php to php5.3. Now all my PHP code is displaying in the page source code like this:

 <div class="bar-icon">
        <!-- FaceBook Share -->  
                 <?php include ('facebook_icon_like.php')?> 
        <!-- /FaceBook Share --> 
  </div>

Please help.

5
  • 1
    What OS? It sounds like PHP wasn't set up properly if it's being displayed in the source. Commented Jul 20, 2012 at 16:48
  • @wanovak Ubuntu Linux 10.04.3 Commented Jul 20, 2012 at 16:49
  • Does your PHP code executes at all? Commented Jul 20, 2012 at 16:50
  • No PHP code does not executes Commented Jul 20, 2012 at 17:00
  • 1
    +1 to offset anonymous downvote. Don't downvote for poor English. Commented Jul 20, 2012 at 17:28

3 Answers 3

5

It means that your nginx engine doesn't have PHP enabled. Follow the instructions here and see if that helps.

Sign up to request clarification or add additional context in comments.

Comments

1

You have to enable PHP into your Nginx server.
If you are using PHP-FPM you could add something like this to your configuration:

server {
    listen 80 default;

    root   /var/www/default/public;
    index index.php;

    location ~ \.php$ {
        include /usr/local/nginx/conf/fastcgi_params;
        fastcgi_index index.php;
        if (-f $request_filename) {
            fastcgi_pass 127.0.0.1:9000;
        }
    }
}

Comments

1

As per your comment, if the file extension is not .php, and you haven't specified any rules for nginx to parse PHP on non-.php files as PHP files, then those files will not execute PHP code.

Change the extension to .php

1 Comment

sorry i put wrong comment ..... it should have this 'No PHP code does not executes' .... so confused (

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.