views:

84

answers:

3

I've just finished a web application written in PHP. I thought it was as easy as compressing my .php files and dumping my database in order to decompress those files in the "production" server, creating the database structure and database user, but it doesn't work. Several php files have include directives that are not working, I was using "relative" paths in those directives, I've tried $_SERVER[DOCUMENT_ROOT] and fixed the trailing slash issue in that parameter and still is not working. Any suggestions? Maybe you know some "tips" or "instalation-patterns" for PHP web applications.

A: 

Are you using the same version of php (and host operating system) on the new server as you were on the old one?

PHP can parse your code differently in different version and installations.

Nico Burns
A: 

PHP has some different behaviors between versions. Also, depending on the setting in your development php.ini file and the one in the production environment, you could see massive differences as they usually have very different security setups.

feihtthief
+1  A: 

Check the include_path on the production server compared to your development machine-- the server may be looking for files in different locations compared to your own box.

Regarding deployment there's two projects that I've come across that might be of some help (unfortunately, I've not used either; both are on my ever-growing to-do list):

  • Phar are PHP Archives; basically, a way of distributing apps in a .zip file that can be run without being unzipped
  • Phing is a build tool similar to Apache Ant. It can be used to automate the deployment, say if you need files copied to many different locations.
Ken Keenan