I'm using nginx on centos 7 with php 5.4.16. I have tried this to adding nginx.conf:

    location ~ \.php$ {
    try_files $uri =404;
    fastcgi_split_path_info ^(.+\.php)(/.+)$;
    fastcgi_pass unix:/var/run/php5-fpm.sock;
    fastcgi_index index.php;
    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    include fastcgi_params;

But there is no sucha file at: /var/run/php5-fpm.sock Also php funcion works without any problem at terminal. But when I send request to php file from web, the output is the raw php code. What should I do?


1 Answer 1


You'll need php-fpm running. This program is responsible for executing php sent on his socket /var/run/php5-fpm.sock

On Debian, just run:

apt-get install php5-fpm

You must log in to answer this question.