部署一个php项目

A newbie to php development looking for help in deploying a php project in Apache server.

I am wonering how to put the php project that is in MVC structure into my Apache server. Say suppose it's a java project then i would export the whole project (with libs, source files etc) as a war file and then deploy the war in the server. My question is, in what format should the php project be put in so that it is up and active running on the server.

Help on this would be really useful to have my project up and running for users. Thanks !

Short answer: Nothing such as WARs in Java or other kinds of "packaging" is needed for PHP scripts. Your server has a special directory set as document root for the web server, you simply place your files inside it (or a subdirectory in it) and you're done.

There are however multiple ways how to bring your files into that directory.

I would use GIT. Make an account to GitHub and create a repository. Look up tutorials on how to commit your files into GIT.

Git Tutorial (GitHub)

Then go to your server and set up GIT folder there and connect to your repository.

Then you will be able to do GIT PULL and update your PHP code within seconds.

OR you can do the annoying style and manually upload files one by one via FTP server.

The first option would be to use a repository, such as GitHub or Assembla. I've used both, and I'd recommend Assembla - but it depends on preferences and requirements. A repository will allow you to commit files to it on a regular basis, and keep all of your work synced together in one location. You can then set up your server to sync with your repository.

If you don't wish to have a repository, then you can simply send all of the files that construct your PHP project to a .zip file. That .zip file can then be uploaded to Apache server, unzipped, and you'll be good to go (providing you have your server configured correctly to match the needs and requirements of the application). You should only need to .zip if you're using cPanel/Plesk, for example.

Alternatively, upload via FTP using a client such as Filezilla.