Building a PHP Project in Jenkins

In a previous article, we gone through the installation of Jenkins on system, here i am taking one step ahead and create job/item in Jenkins for our project, I am creating build project for PHP.PHP is interpreted language so we don’t need any compiler to create build jar/exe file, we just copy files from our workspace to production /var/www/ folder.

I am assuming you have you have created your build and config file of your PHP project and mentioned source and target location of your file into config.xml file.This is very simple article which help to understand functionality of creating job in Jenkins and how’s set job parameters, so i am not using any version control like SVN/GIT.

I am using ANT for create build on server, so if you don’t have ANT on server, you can install using below command on linux and for windows you can refer this article

sudo apt-get install ant

Create and Build the project in Jenkins

Step 1: Click New Item option from Left hand side menu.

Step 2: Write You Job Name ex-PHPbuild and select Free style project.

Step 3: Select Source Code management NONE.

Step 4: Chose Invoke ANT under Build Environment.

Step 5: Select 'ANT' profile from Invoke ANT dropdown.

This dropdown has your ant profile which you have installed on your system, if you do not have any please write down a ant profile name and select Install automatically ant.

Step 6: Save your job.

Step 7: Go to your Jenkins dashboard and select your job PHPbuild.

Step 8: Clicked Build Now link.


Now you can see your build under build history,if circle color is blue that means your have created successfully build otherwise red with error,You can see you error using console output.