Question

Unable to open primary script. cannot move it from etc/nginx/html.

Posted June 7, 2015 10.4k views
Nginx CentOS PHP

Hi, i’ve followed this guide:

https://www.digitalocean.com/community/tutorials/how-to-install-linux-nginx-mysql-php-lemp-stack-on-centos-7

i believe i’ve followed it correctly. i had it working (step 5 worked), then i wanted to change the default directory (for the websites) to /usr/home/Solder. but when i try to access info.php which is in that directory (as a test) i get no input file specified. i check the error logs for nginx and it shows:

FastCGI sent in stderr: "Unable to open primary script: /etc/nginx/html/info.php (No such file or directory)"

i did have to change Doc_Root in php.ini to the location for step 5 to work, i have changed that to usr/home/Solder now.
its changed to that directory and i dont know why. it wouldnt be file permissions, because it’s showing an entirely different path

i am quite fresh with Linux, so forgive me if its an easy fix

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

2 answers

Post your config file, e.g. /etc/nginx/sites-available/default if you use this. Then it is possible to see what you did wrong.

I believe you did that wrong (in config file e.g. /etc/nginx/sites-available/default) :

Change root:

root /usr/home/Solder

To create a new info.php do this:

touch /usr/home/Solder/info.php
nano /usr/home/Solder/info.php

Paste this (right click):

<?php
phpinfo();
?>

Restart your Server service nginx restart

Submit an Answer