Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7724903
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T04:48:19+00:00 2026-06-01T04:48:19+00:00

i am trying to change user agent in php.ini file as follows. user_agent=Mozilla/5.0 (iPhone

  • 0

i am trying to change user agent in php.ini file as follows.

user_agent="Mozilla/5.0 (iPhone Simulator; U; 
CPU iPhone OS 4_3_2 like Mac OD X; en-us) 
AppleWebKit/535.17.9(KHTML, like Gecko) 
Version/5.0.2 Mobile/8H7Safari/6533.18.5"

after that when i check user agent in my php file with following command and this show that user agent has not been change.

echo $_SERVER['HTTP_USER_AGENT'];

this shows : Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Win64; x64; Trident/5.0)

which is still not iphone user agent which i have set in php.ini file.

so please help me how to set user agent in php.ini file which switch my browser request as iphone browser request.

i have also tried with following command.

ini_set('user_agent', 'Mozilla/5.0 (iPhone Simulator; U; 
    CPU iPhone OS 4_3_2 like Mac OD X; en-us) 
       AppleWebKit/535.17.9 (KHTML, like Gecko) Version/5.0.2 
       Mobile/8H7 Safari/6533.18.5');

this also gives same result and i am unable to switch to iphone browser request.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T04:48:20+00:00Added an answer on June 1, 2026 at 4:48 am

    I’m afraid you’ve misunderstood. The user_agent setting in php.ini has nothing to do with $_SERVER['HTTP_USER_AGENT].
    The setting in php.ini is used as a default for when PHP does HTTP requests, for example with cURL.

    $_SERVER['HTTP_USER_AGENT'] contains the user agent that the web browser sent along with its request to your PHP script. That’s why it’s showing MSIE because you’re viewing the page in MSIE.

    If you want to send a different user agent from your browser, you’ll have to use a browser plugin unless the browser allows you to freely modify it. For example like this.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to change some config file user settings values in my WPF application,
ZF 1.9.6 Trying to change the module based on the user agent of the
I'm trying to change the User-Agent and X-Mailer headers sent out by CodeIgniter's email
I'm trying to change view controllers based on a user's selection in a UIAlertView
I'm trying to write a C program to change a user password using Linux
Working in WPF, writing a custom user control. I am trying to change the
I'm trying to change user input in wildcard form (*word*) to a regular expression
I am trying to change the body background color when the user changes the
<script language=Javascript> var deviceIphone = iPhone; var deviceIpod = iPod; //Initialize our user agent
I am trying to change my website background image (at body tag) when user

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.