Install file permissions for linux running FastCGI / SuPHP

The following only applies to those running SC development software on a linux server.

I have FastCGI setup on my server. This is becoming more common with other Cpanel webhosts like BlueHost or HostGator. On FastCGI systems all folders have permission 755 and files are set to 644 permission with the exception of executable files such as .so, .pl etc.

You never need permission 777 for folders on systems running php as FastCGI since on Cpanel scripts run as the actual Cpanel user instead of “nobody”. This really simplifies things in my opinion.

I’m writing this because it may help someone on the same setup.

The problem is a lot of zip install packages with have file and folder permissions set when you extract them. I’ve had this issue with zip install packages for linux from SC and others. The result is a lot of folders with permissions set to 777 and php files set to 755 when you extract. These permissions will not run on FastCGI at all and will generate a server misconfiguration error.

There are a couple of ways to handle this.

  1. extract all files from the zip file on your computer and upload them by FTP to the server. Typically the correct permissions for folders and files will be set as they are uploaded. (this can take forever with SC btw)

  2. A faster way is to upload the zip file, extract it on the server and use Filezilla to set the correct permissions for folders and files. Once the files and folders are expanded on the system open Filezilla and FTP to the site. Right click on the directory that has the installation with the messed up permissions after extraction. Choose “File Attributes” from the pop open menu. Near the bottom of the menu that opens you will see the option to “Recurse into subdirectories”. Enter 755 into the permissions box, check the Recurse option and choose “Apply to directories only”. Once filezillia is done (can take a while), repeat the process but this time set permissions to 644 and choose the option “Apply to files only”.

Now you have one more thing to do. With SC there are executable files located in devel/lib/third/zend. All of the files in that directory need to have permissions 755 to execute.

Last word: I’ve had permission issues on FastCGI with SC fresh install packages. But worst of all is this also sometimes happens with auto-update right from SC. The last time this happened I spent most of the day trying to get back up until I figured out that it was a permission issue, the one that really threw me as finding the executable in the zend folder.

BTW, if you have shell access (SSH) you could do the same thing faster through command line. A lot of people are on shared hosting running FastCGI and I wanted to cover how to do this without SSH access.

I’m hoping that this helps some one.

Thanks for sharing. It is much appreciated.

You are welcome. Hope it saves some others trouble.

Quick one please. Does this still apply with Centos 7? Or are there still other things to set?

Muy buen aporte para los que hemos tenido estos problemas de permisos y modos de ejecuccion del servidor.

Thanks for this post. I have recently moved my development to linux VPS server with CentOS6 and started experiencing this same issue. Followed your guide and it worked well.

you wrote " Now you have one more thing to do. With SC there are executable files located in devel/lib/third/zend. All of the files in that directory need to have permissions 755 to execute."

I can’t find above location in my production system. I am using sc8.1. Not sure it has changed the folder location on later sc versions, but the app seems to be running OK so far.

Also, I used the shell to update folder permission after browsing to the extracted folder.

find -type d -exec chmod 755 {} ;
find -type f -exec chmod 644 {} ;