How can I set taxonomy programmatically

You should hook your actions to the save_post hook. It fires right after the post is created and the $post_id and other $post data variables are already available.

Something like this should do the trick:

add_action( 'save_post', 'jason_code_save_post', 10, 2 );

function jason_code_save_post( $post_ID, $post ) {

     if ( 'code' != $post->post_type || wp_is_post_revision( $post_ID ) )
          return;

     wp_set_object_terms( $post_ID, 'PHP', 'tag' );

}

See Plugin_API/Action_Reference/save_post.

Let me know if something needs more explanation…