title: How to create ipa file using php
body: <p>I am trying to run shell script from php file to build and archive the ios application. Here is what i have done so far</p>
  
  <p>In my test.php file i have written below code:</p>
  
  <pre><code>&lt;?php
      echo shell_exec("sh build.sh");
  ?&gt;
  </code></pre>
  
  <p>In build.sh i have written:</p>
  
  <pre><code>PROJDIR="/Library/WebServer/Documents/ExpertIPA/IPA/MyApp"
  PROJECT_NAME="MyApp"
  APPLICATION_NAME="MyApp"
  TARGET_SDK="iphonesimulator6.0"
  PROJECT_BUILDDIR="${PROJDIR}/build/Release-iphoneos"
  TARGET_TEST_NAME="ExpertApp"
  BUILD_HISTORY_DIR="${PROJDIR}/ipa/" #where you want the .ipa to go
  DEVELOPER_NAME="iPhone Distribution: developer Name"
  PROVISONING_PROFILE="/Library/WebServer/Documents/ExpertIPA/IPA/ExpertApp/
  MyApp_distribution.mobileprovision"
  
  
  echo Building Project
  cd "${PROJDIR}"
  build_type_iOS=$2
  
  
  xcodebuild clean -configuration "${build_type_iOS}"
  xcodebuild -target "${PROJECT_NAME}"  -configuration Release
  
  
  if [ $? != 0 ]
  then
     exit 1
  fi
  
  /usr/bin/xcrun -sdk iphoneos PackageApplication -v "${PROJECT_BUILDDIR}/${PROJECT_NAME}.app" -o "${BUILD_HISTORY_DIR}/${APPLICATION_NAME}.ipa"  --embed "${PROVISONING_PROFILE}"
  </code></pre>
  
  <p>when i running my build.sh file from terminal it creates MyApp.ipa successfully, also when i am running test.php on mac terminal its working fine, but when i am running test.php from browser it gives following error message.</p>
  
  <p>Error message:</p>
  
  <p><strong>BUILD NATIVE TARGET MyApp OF PROJECT MyApp WITH CONFIGURATION Release === Check dependencies Code Sign error: The identity 'iPhone Distribution: Profile_Name' doesn't match any valid, non-expired certificate/private key pair in your keychains</strong></p>