• If you are still using CentOS 7.9, it's time to convert to Alma 8 with the free centos2alma tool by Plesk or Plesk Migrator. Please let us know your experiences or concerns in this thread:
    CentOS2Alma discussion

Issue AH01071: Got error 'Unable to open primary script: ( Too many open files )

gdc

New Pleskian
Server operating system version
AlmaLinux 8.5
Plesk version and microupdate number
18.0.57 #2
I recently started having unexpected issues with my Plesk Obsidian based server running on AlmaLinux 8.5. The server had been up and running for over 180 days without issue with over 160 domains. The past three days it's started showing a white page, that says 'No input file specified' for one of the domains. I can refresh the page a couple of times and it'll eventually load, until you try to go to the next link or page, then the same thing happens. It'll log errors AH01071: Got Error 'Primary Script Unknown' and AH01071: Got Error 'Unable to open primary Script' /var/www/vhosts/domain_name/httpdocs/file.php ( Too many open files ). I can restart the server and it runs fine until about the same time the next day. The domain is running on PHP 7.4.33 as an FPM application under Apache. Any help or insight would be greatly appreciated. The server was runing 18.0.54, but I updated it to 18.0.57 #2 to see if it might resolve the issue. I ran the diagnosis and repair utility on the domain and it didn't find any issues.
 
You probably need to increase the number of allowed open files on your system. You can check the number of open files with
# lsof | wc -l

Increase the general maximum file descriptor value:
# vi /etc/sysctl.conf

Add/modify:
fs.file-max = 500000

Reload the system daemon:
# systemctl --system daemon-reload
# sysctl -p

# vi /etc/security/limits.conf
and add:

nginx soft nofile 500000
nginx hard nofile 500000
root soft nofile 500000
root hard nofile 500000
psaadm soft nofile 500000
psaadm hard nofile 500000
mysql soft nofile 500000
mysql hard nofile 500000
httpd soft nofile 500000
httpd hard nofile 500000

or instead fo 500000 another large number that fits your system.

It may be necessary to also configure max open file variables in some services, but you can first try it with the general settings.
 
You probably need to increase the number of allowed open files on your system. You can check the number of open files with
# lsof | wc -l

Increase the general maximum file descriptor value:
# vi /etc/sysctl.conf

Add/modify:
fs.file-max = 500000

Reload the system daemon:
# systemctl --system daemon-reload
# sysctl -p

# vi /etc/security/limits.conf
and add:

nginx soft nofile 500000
nginx hard nofile 500000
root soft nofile 500000
root hard nofile 500000
psaadm soft nofile 500000
psaadm hard nofile 500000
mysql soft nofile 500000
mysql hard nofile 500000
httpd soft nofile 500000
httpd hard nofile 500000

or instead fo 500000 another large number that fits your system.

It may be necessary to also configure max open file variables in some services, but you can first try it with the general settings.
Thanks for the suggestion, I'll give it a try. What I don't understand, is how the server can run for 6 months with no issues, then all of a sudden it won't run for more than a day without issues, now going on 4 days in a row, although nothing new has been added to the server.
 
Back
Top