I have just installed nginx and php-fpm according to this http://blog.frd.mn/install-nginx-php-fpm-mysql-and-phpmyadmin-on-os-x-mavericks-using-homebrew/ I am now visiting a php webpage and the php code is not been rendered
<?php echo 'test' ?>
I have just installed nginx and php-fpm according to this http://blog.frd.mn/install-nginx-php-fpm-mysql-and-phpmyadmin-on-os-x-mavericks-using-homebrew/ I am now visiting a php webpage and the php code is not been rendered
<?php echo 'test' ?>
Your problem is related with nginx configuration not php-fpm itself.
Nginx needs to be configured to let him now what to do with each file type. By default it is throwing files as static (the result is the raw content of the file as you report).
An basic example of nginx routing to set php-fpm as fast-cgi service for *.php files would be:
nginx.conf
server {
....
location ~ \.php$ {
try_files $uri =404;
fastcgi_pass unix:/var/run/php5-fpm/DOMAINNAME.socket;
fastcgi_index index.php;
include /etc/nginx/fastcgi_params;
}
}
Check this basic example: https://support.rackspace.com/how-to/install-nginx-and-php-fpm-running-on-unix-file-sockets/
If you want more advanced examples:
This nginx.conf for Symfony (app.php is the Symfony2 bootstrap file). https://gist.github.com/leon/3019026
Lumen use case. https://gist.github.com/psgganesh/8d1790dd0c16ab5a4cde
And if you are interested in a deeper learning:
<?php phpinfo(); ?>show anything? What does the access log for nginx show? Does view source show the actual PHP source code? Have you tried setting display_errors = 1, error_reporting = E_ALL?