Avatar of Jack_son_
Jack_son_
Flag for Afghanistan asked on

PHP/Apache/MySQL Custom Application

I need to move a debian PHP/Apache/MySQL custom app to a new server.  I need some help, generally speaking which folders would I look for in the structure to move?  I know the main one sites-enabled file and www folder as well.  I have moved these, but now apache won't start.  Any help would be appreciated.

Also, is it possible to migrate to a windows OS using the same PHP / Apache and MySQL?
PHPApache Web Server

Avatar of undefined
Last Comment
artzter

8/22/2022 - Mon
DrDamnit

Generally speaking, all you have to do is:

1. Create the site in the new server. This involves copying the configs and directives from the /etc/apache2/sites-enabled/000-default (or similar) apache config file to the new server, then restarting the apache service (/etc/init.d/apache2 restart).

2. Move the MySQL databases. I suggest using mysqldump --databases [yourdatabase] > /tmp/dbdump.sql, and then using scp to copy it to the new server. Then use mysql -uroot -p[password] < /tmp/dbdump.sql to import it again. This moves the data.

3. Lastly, just tar up (tar -zcvf customapp.tar.gz /var/www/customapp/) the php files, then scp them to teh new server, and untar them (tar -zxvf customapp.tar.gz).

This will do it for 99% of custom apps. Unless you have something very specific and highly customized.
DrDamnit

I missed the bit where you said: "apache won't start".

Stop the apache service (/etc/init.d/apache2 stop). Then try to start it manually from the command line:

apache2

When it fails, it should tell you why. Also, check the apache2 logs (/var/log/apache2). Post anything that seems relevant here, and I'll (we) will have a look.
Jack_son_

ASKER
Here are the errors:

*.80 has no virtual hosts

also

var/www/domain.com/public does not exist

I do see  the folder but it is empty on the old server where it works and also here.
Your help has saved me hundreds of hours of internet surfing.
fblack61
DrDamnit

Need more information on the "old" config. Can you post the old config?
Jack_son_

ASKER
If I take out this file under sites-enabled and just use the default file, apache will start, here is the file for the app:  (is there a way to incorporate this into the default file?




<VirtualHost 10.10.20.10:80>
      CustomLog /var/log/apache2/name.com/access.log combined
      LogLevel warn
      ErrorLog /var/log/apache2/name.com/error.log

      ServerName  name.com
      ServerAlias www.name.com

      DocumentRoot /var/www/name.com/public
</VirtualHost>
# vim: syntax=apachestyle


also, when I have apache started without this file, I am unable to browse to it from a remote computer, only on the local computer can i browse to the apache website.
ASKER CERTIFIED SOLUTION
artzter

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question