Gsg
By:
Gsg

Moving from Windows php to Linux

March 18, 2015 972 views
PHP Linux Basics Ubuntu

I am a newbie to linux. I have a website built on windows php. What needs to be changed in my files to make it compatible with apache?

1 comment
  • What Linux / windows specific things might need to be done in php? And I do have a MySQL db I need to set up. I have done all steps below. I have web config file I am wondering where to place. Thanks for helping. Sorry if these are basic questions.

1 Answer

In most cases you should not have to change anything. There are a few Windows/Linux specific things that can be done in php but for the most part everything should work. To import your php app you will want to:

1.) Create a new droplet. I would recommend the LAMP Application image as this will provide you with a ready to use server environment with php.

2.) Upload your files using SFTP to the /var/www/html directory

3.) Navigate to your droplet by IP (or domain if you have configured one) in a browser and test your script.

Of course if your app includes a database there will be additional steps to import your data.

  • What Linux / windows specific things might need to be done in php? And I do have a MySQL db I need to set up. I have done all steps below. I have web config file I am wondering where to place. Thanks for helping. Sorry if these are basic questions.

  • Can you clarify what type of "web config file" you have?

    If you are able to export your current MySQL database to a SQL file you can import it via ssh.

    1. Upload the .sql file to your droplet.

    2. Log in via ssh and the MySQL root password should be displayed in the MOTD shown when you first log in.

    3. Use the following commands to first create a new empty database and then import your .sql file.

    mysql -u root -p
    

    You will be prompted for your MySQL root password and then logged into a MySQL shell.

    CREATE DATABASE mydatabase;
    exit;
    

    Then you can import your sql data

    mysql -u root -p mydatabase < file.sql
    
Have another answer? Share your knowledge.