php files are not woking in my websitehttps://www.lodestar.guru/blog

https://www.lodestar.guru/blog
above url developed in wordpress, we tried upload .php file it is not working in our website, pls let us know how to enable the php files to work in my website: https://www.lodestar.guru/blog

1 Reply

If you're not able to run php code, it's likely due to either php not being installed or perhaps your web server software is not configured to serve php files.

I can see that your domain is using nginx:

curl -sIL https://www.lodestar.guru/blog/ | grep Server
Server: nginx

To get php working with nginx, you'll need to make sure the php-fpm package is installed (and running) and configure your site's nginx configuration file to use php-fpm.

Here's a few guides that should help you get sorted out:

  1. Serve PHP with PHP-FPM and NGINX
  2. LEMP Guides, including guides for CentOS 7, Ubuntu 18.04 and Debian 9

Your nginx configuraiton file is possibly located within /etc/nginx/conf.d/ or /etc/nginx/sites-available/ and might be called lodestar.guru.conf or something similar. Within this file, make sure to add a location block for php (similar to the one below) within your site's server block.

location ~* \.php$ {
    fastcgi_pass unix:/run/php/php7.2-fpm.sock;
    include         fastcgi_params;
    fastcgi_param   SCRIPT_FILENAME    $document_root$fastcgi_script_name;
    fastcgi_param   SCRIPT_NAME        $fastcgi_script_name;
}

Take a look throuh the guides I linked to for full instructions. If you're still running into issues, it may help to explain the problem in more detail, as well as let the community know which operating sytem you're using and the version of php you're running.

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct