Website is working on the local machine but not on the server
When you encounter an issue like the “website is working in the local system but not on my server” the common reason as to why you are facing such issues are listed below. This is a very common issue when moving your website or web application developed locally and moving to any dedicated or hosting server.
File permission is incorrect :
In most the case, when the website is not working, it will be because the file permission of file on your website is incorrect. When the files are being uploaded we check if appropriate permission is given to the files and folders, the permission for files should be 644 and the permission for folders should be 755.
File uploaded in the wrong path:
When the file is uploaded the wrong path, your website will not work. Be sure that the files are being uploaded to the correct path. Normally in Linux shared hosting the path for the primary domain where the files should be upload is /public_html and for its addon domain the path public_html/domainname or /domainname in the file manager, and for windows hosting the files should be uploaded in httpdocs or /domainname.
For example, You could be developing your website in your Windows system, Such as Windows 7 or Windows 10. Windows Desktop file systems are different from linux file systems. You might be using XAMPP or similar tool to develop your website, When developing a website, most likely you might have hard-coded some values such as D:\some_project\some_folder\some_files.php, When you upload these files to the sever, It will not work as the files are missing in the give directory. That's why, You should never hard code the file path or values in the source.
When php version and other setting are incorrect
After you upload the files in the server, check from c-panel required php version, short_open_tag and other needed extensions are available. In Linux hosting, you can change the php version using the php.ini file and in windows hosting you can change it in hostings settings.
Let us assume a example scenario,
1. You might have a developed a website, In your local machine using old version of PHP and Apache combination, Such as PHP 5.6. When you develop a website using PHP 5.6 and you have uploaded these to the server, Which is using latest version of PHP, such as 7.0 or 7.1 then most likely you will have a problem. PHP 5.6 may have some extension such as .so file, which will not be compatible with the latest version available with server. As No.1 hosting company in India, HostingRaja always uses the very latest technologies available to the customers.
DNS setting is incorrect
When nameserver or IP updated for your domain is incorrect or not properly updated or if it's not pointing to the present server where you hosted, your website may not work. As a solution to this issue go to the domain control panel and update the correct nameserver or IP or you can also your domain provider to correct the nameserver or the IP
No index page for the website
Most of the time the user forgets to upload the index file for his domain while uploading the files for the domain, index page or the home page is the default page for any domain
Files are uploaded inappropriately
Sometimes when the file is being uploaded, it might not be uploaded properly for example when you have uploaded the file compressed format like ‘.zip’ or any other format, and when unzipped the files would not be unzipped properly in such cases you will need to re-upload the files
Incorrect code .htacces file () or web.config file
When you face website not working issue it's better to start check from the .htaccess or web.config file,In Linux hosting .htaccess file is used and in windows hosting web.config file is used. When the default code for .htacces file or web.config file is wrong your website may not work on the server.
Your website may not work on the server if the database name, database user and password in the configuration are incorrect or different from the database which has been created
The URL or file path is wrong
The file might have been uploaded the wrong folder or inside the other folder, for example, let us take the domain name example.com the file of example.com is been uploaded in the path public_html/wp so the user should use the URL example.com/wp to access the domain
Incorrect database version and credentials (Username & Password Mismatch)
When you develop a website, It is very common that, developers starts his development work with default user name and password. Example, If the developer name is kumar, then the developer keeps the username as kumar and password as kumar123. But, When you lauch the project, developers might change the username, password or even the Database name. This will cause a problem. You should avoid hardcoding the DB username, password and database name, It should always configured in some common settings or config file.
Missing files, When uploading using filezilla
When you upload a website which is developed locally in your local machine using software such as Filezilla or any other applications, If there is a poor connectivity, then during upload few files may go missing. It is very common that, Nowadays CMSs such as Joomla, Drual and WordPress or any other CMS has 1000s of files including all the PHP, JS and css files. It is vey much possible that, some files might go missing. So thats why we suggest you to zip the file and upload it to the server, Once upload is completed, you can unzip it. But, When you unzip/untar the file, make sure that the permissions are set to correct. It is even possible that, Some of the tables might be corrupted or missing, then in this case also, Website will not work.