Problem installing CS-cart 2.11

Hello. I set up a database using MYSQL 5.0 which has worked before. I uploaded all of the files and changed permissions on the following files to 777

admin.php

config.php

index.php

**could not find image.php (don’t know why… any idea?)



Changed permissions to the following folders to 777

var

images

skins



Accoding to the manual, it tells me to go to http://www.my_site.com/install/

(using my domain of course). When I do I get ERROR 404 “Not Found”.

I’m lost.

NOTE: I also tried going to [url]http://www.yoursite.com/cscart_dir/[/url] as Siteground directs me to do (again using my domain of course).

Any ideas would be greatly appreciated! I’m lost!

First off … are you completely certain you are getting a “404 Not Found” and not a “500 Internal Server Error”?



(On SuPHP / phpSuExec / and FCGI systems, you will get a “500 Internal Server Error” page if you attempt to set 777 permissions to any file or folder in your account)



On DSO systems, you COULD set 777 permissions but it is still NOT recommended from either a security or operational perspective and quite contrary to what CS-Cart would want you to think is most certainly “NOT” required and is quite unsafe using those permission settings.



My first advice to you would be to determine what kind of PHP is being used with your hosting account and then work things from there as you will need different permissions and installation steps depending on what type of PHP you have.



If you are on a shared hosting account, your hosting provider should be able to tell you if you ask them what you have running.



You can also check phpinfo() and partially tell from the information shown on that screen as DSO will be shown an “Apache Handler”, SuPHP and phpSuExec both show as “CGI”, and FCGI shows up as “CGI/FastCGI”.



Now aside from permissions and getting back more to the basics, did you put your files in the correct location when you uploaded them? Cpanel servers require you to switch to the “public_html” folder when uploading files and some systems require “wwwdocs”, “httpdocs”, or something similar and if you don’t change to the correct folder then your files are uploaded to the wrong location.



Hope this helps …

The url should just be http://www.mysite.com and permissions should be:



config.local.php 666 (change back to 644 afterwards)

catalog 777

images and sub directories 777

var and sub directories 777

Stangunner



Listen to Roban. Folders and subfolders, but not files!

[quote name=‘Noman’]Stangunner



Listen to Roban. Folders and subfolders, but not files![/QUOTE]

Both of you are blindly making the assumption that Stangunner is DSO …



From his own description of the problem, there can actually be multiple possibilities here.



Before any real solution can be given, 2 things really need to be known first:


  1. Is Stangunner really DSO or some other type of PHP?


  2. Is the error page Stangunner described really indeed “404” or is it “500” (or even something else such as 403)?



    The solution to his particular issue will be different depending on the answers to each of the above questions and both would have a major impact to his situation.

I mean, the introduction of CS-Cart installation in their manual is absolutely wrong (the highlighted line):


[quote]

The next step is setting file access permissions.

On a UNIX-based server with terminal access to it, run the following commands one

by one:



chmod 666 config.local.php

chmod -R 777 catalog

chmod -R 777 images (+ subfolders)

chmod -R 777 skins

chmod -R 777 var (+ subfolders)



If you do not have terminal access to your server, you can change file access

permissions using an FTP client. Most of them have the “Change permissions” or

“Change mode” functions. With the help of the function you are to set the permissions

for the ‘config.php’ file and the directories listed above. The ‘chmod 666 config.php’

command means that you must set 666 permissions (in other words, read, write and

execute permissions for the file user, group and other) for the ‘config.php’ file. Other

commands (e.g. ‘chmod -R 777 catalog’) mean that you must set the same 777

permissions for the directory, [COLOR=Red]its subdirectories and all the files under these directories.

[/COLOR]

[/quote]

… and let’s stay with what Indy {CS guys] said about it.

Indy0077, you are absolutely correct … CS-Cart did write the instructions wrong!



Totally disregarding the argument of the security concerns whether or not you should even use 777 permissions in the first place, there is still other problems with the instructions that CS-Cart has written and I do wish they would update those instructions on at least these two points:

[i]

  1. As you pointed out, the permission update instructions should not include the files, just the folders …


  2. There is no mention in the instructions telling users that the instructions were written specifically for DSO servers [COLOR=“Red”]ONLY[/COLOR] and users who don’t know that and try to follow their instructions on non-DSO based servers (such as those that are CGI, phpSuExec, SuPHP, or FCGI) are going to get themselves into trouble and many probably would have no idea why or what they should do instead …

    [/i]

    Aside from making assumptions in their instructions, CS-Cart makes the same assumptions in their code and there is quite a few places where chmod() commands are used blindly setting ‘777’ permissions without any checks to determine what system type is actually in place where the CS-Cart is installed.



    An easy fix for this is to re-write the code to set “755” where “777” is used originally (Non-DSO servers) but that should not be necssary. A much better and far more logical solution would be if CS-Cart would just go ahead and put in code to test and determine the system type where a CS-Cart installation is being used and select the correct script code for that specific system. This would only require just a couple of extra lines of code and there is even a PHP function to help and all of this is very simple and easy to implement.

Until CS-Cart properly addresses this issue by testing for the environment as suggested by Spiral, you can modify the permissions on newly-created files and directories in config.php:

// Default permissions for newly created files and directories
define('DEFAULT_FILE_PERMISSIONS', 0666);
define('DEFAULT_DIR_PERMISSIONS', 0777);




Prior to running the installation, change these to ‘0644’ and ‘0755’, respectively, if you are not running a DSO system . This should probably be the default until CS-Cart better addresses this issue.



If you have already run the installation and have SSH access, you can run the following commands to reset the permissions:


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




Bob

By the way, it appears config.php will be replaced when you do an upgrade. You will need to make the above changes to config.php after each upgrade.



You will also want to run CHMOD commands since your upgrade directory(e.g., /var/upgrade/upgrade_2.0.10-2.0.11.tgz) will have directories/files set at 777/666.



Bob

[quote name=‘jobosales’]

If you have already run the installation and have SSH access, you can run the following commands to reset the permissions:


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




Bob[/QUOTE]



Thanks for the commands, I use it to set my folder permissions to 755 and files to 644 via SSH (running fastcgi).

[quote name=‘Spiral’]Indy0077, you are absolutely correct … CS-Cart did write the instructions wrong!



Totally disregarding the argument of the security concerns whether or not you should even use 777 permissions in the first place, there is still other problems with the instructions that CS-Cart has written and I do wish they would update those instructions on at least these two points:

[I]

  1. As you pointed out, the permission update instructions should not include the files, just the folders …


  2. There is no mention in the instructions telling users that the instructions were written specifically for DSO servers [COLOR=Red]ONLY[/COLOR] and users who don’t know that and try to follow their instructions on non-DSO based servers (such as those that are CGI, phpSuExec, SuPHP, or FCGI) are going to get themselves into trouble and many probably would have no idea why or what they should do instead …

    [/I]

    Aside from making assumptions in their instructions, CS-Cart makes the same assumptions in their code and there is quite a few places where chmod() commands are used blindly setting ‘777’ permissions without any checks to determine what system type is actually in place where the CS-Cart is installed.



    An easy fix for this is to re-write the code to set “755” where “777” is used originally (Non-DSO servers) but that should not be necssary. A much better and far more logical solution would be if CS-Cart would just go ahead and put in code to test and determine the system type where a CS-Cart installation is being used and select the correct script code for that specific system. This would only require just a couple of extra lines of code and there is even a PHP function to help and all of this is very simple and easy to implement.[/quote]



    Yes I agree with you, it should be there an install check to checking the server if DSO or not …

[quote name=‘nodame’]Thanks for the commands, I use it to set my folder permissions to 755 and files to 644 via SSH (running fastcgi).[/QUOTE]



I have tightened this up a bit further based on additional research and information from forum member Spiral. This works for me in a suPHP environment without any problems:

find . -type d -exec chmod 755 {} \;
find . -type f ! -name "*.php" -exec chmod 644 {} \;
find . -type f -name "*.php" -exec chmod 600 {} \;




Make sure you also set the default permissions for new files and directories in config.php:

// Default permissions for newly created files and directories
define('DEFAULT_FILE_PERMISSIONS', [COLOR="Red"]0644[/COLOR]);
define('DEFAULT_DIR_PERMISSIONS', [COLOR="red"]0755[/COLOR]);




[COLOR=“Red”]NOTE: The changes are not meant for DSO setups.[/COLOR]



For additional security-related best practices, see this thread:

[url]http://forum.cs-cart.com/showthread.php?t=15083[/url]



Bob