This article is going to take a look at one of the potential issues that cause images to not appear after uploading to a site. This is going to appear as a 404 error and or a blank image in the websites gallery area.
This can be caused by incorrect ownership of the files from the PHP process itself.
This issue will happen if you are using an incorrect PHP Handler, and you will see the file ownership issues as such below.
[13:07:53 www1 root@93479772 ~]cPs# /usr/local/cpanel/bin/rebuild_phpconf --current
DEFAULT PHP: ea-php56
ea-php55 SAPI: cgi
ea-php56 SAPI: cgi
ea-php70 SAPI: cgi
[13:11:18 www1 root@93479772 ~]cPs# /usr/local/cpanel/bin/rebuild_phpconf --available
ea-php55: cgi fcgi none
ea-php56: cgi fcgi none
ea-php70: cgi fcgi none
The CGI handler will create files owned by "nobody", as you see below.
[11:16:30 www1 root@93479772 /home/CPUSER/]cPs# ls -alh
total 16K
drwxrwxrwx 2 CPUSER CPUSER 69 May 2 18:47 .
drwxr-xr-x 5 CPUSER CPUSER 4.0K May 2 16:56 ..
-rw-r--r-- 1 nobody nobody 243 May 2 17:06 811FBAE530.png
-rw-r--r-- 1 nobody nobody 235 May 2 17:14 89CA7B635A.png
-rw-r--r-- 1 nobody nobody 240 May 2 18:47 DC01DB2626.png
When the ownership is incorrect, the files will show a 404 error. This incorrect ownership will not allow the images to display correctly on their own or via a preview link such as WordPress's Media Gallery.
The solution to this particular issue is to use the PHP Handler "suPHP". Using this handler will allow the processes to run as the user and create the files correctly with the fitting ownership.
The following articles will allow you to further research this topic and choose the correct handler.
https://docs.cpanel.net/ea4/php/php-handlers/#change-your-php-handler
https://docs.cpanel.net/whm/scripts/the-rebuild_phpconf-script/82/
https://docs.cpanel.net/ea4/php/manage-php-handlers-in-easyapache-4/
Comments
0 comments
Article is closed for comments.