skip to Main Content

I’m a web designer and working with a new developer on a project.

I have a web server for my hosting thats based on Cloud Linux developed by Centos. But the developer wants to host the site themselves stating that they have written the scripts and code to specifically work on a ubuntu web server.

I’m curious if writing code specific to only work with one variant of linux is common or is he just saying this so he controls the hosting? I’m suspicious!

2

Answers


  1. Try the following:

    <?php
    
    $u_agent = $_SERVER['HTTP_USER_AGENT'];
    if (preg_match('/ubuntu/i', $u_agent)) {
    
        //Do code for Ubuntu Only here for example
            echo 'This is Ubuntu';
    
    
    }
    else {
    
    //Do here what is done when not Ubuntu
    
    }
    

    This answer is based on ‘Detecting Operating System’ at: https://www.roytuts.com/detect-operating-system-using-php/

    Login or Signup to reply.
  2. The scripts and code written by the developer will work on any linux ONLY if the server has same software & services with required dependencies.
    If you have any scripts for cron,reports,backup etc.. you have to test the scripts in the new environment.Sometimes there might be a little customization.

    Kindly find the Migration Plan:
    1.Deploy Linux (Install OS with required hardware configuration)
    2.Install Software & Enable services (with required dependencies)
    3.Back up Your Data (Webfiles,db,configuration files and other backup files)
    4.Use rsync to transfer your backup data into the new server
    5.Test the new environment
    6.Point DNS Records to the new server

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search