Reputation: 1257
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.
Upvotes: 3
Views: 5677
Reputation: 6127
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
Upvotes: 1
Reputation: 12420
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;
}
}
}
Upvotes: 1