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 4021324
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T10:20:15+00:00 2026-05-20T10:20:15+00:00

I am trying to run some PHP pages on the command line but am

  • 0

I am trying to run some PHP pages on the command line but am running into a few problems with mysql and other PHP extensions.

Running php --ini produces the following output:

Configuration File (php.ini) Path: /usr/local/lib
Loaded Configuration File:         (none)
Scan for additional .ini files in: (none)
Additional .ini files parsed:      (none)

When I run php on the command line it cannot find my php.ini file. This is because the path is incorrect. My php.ini is actually located in /etc/php.ini as stated in my phpinfo(); file. PHP runs fine in the browser.

How do I change the path of my php.ini file for command line PHP?

I am running Apache2 (CentOS-5.5) and PHP 5.2.6.

  • 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-05-20T10:20:16+00:00Added an answer on May 20, 2026 at 10:20 am

    Using the -c option, you can specify which php.ini file should be used :

    php -c /etc/php.ini your-php-script.php
    

    As a reference, see the output of php --help :

    $ php --help
    Usage: php [options] [-f] <file> [--] [args...]
           php [options] -r <code> [--] [args...]
           php [options] [-B <begin_code>] -R <code> [-E <end_code>] [--] [args...]
           php [options] [-B <begin_code>] -F <file> [-E <end_code>] [--] [args...]
           php [options] -- [args...]
           php [options] -a
    
      -a               Run as interactive shell
      -c <path>|<file> Look for php.ini file in this directory
      -n               No php.ini file will be used
      -d foo[=bar]     Define INI entry foo with value 'bar'
      ...
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've run into some problems when trying to serialize my object to XML. The
The Problem I am trying to run some ajax on one my pages for
I am trying to rewrite some server php code which logs into a website,
I have a few questions about PHP memory usage. I'm going to run some
I'm trying to run some statistics over the Stack Overflow data dump, and for
Ultimately I am trying to run some code which depends on the value (or
I am trying to run some Scala code on my OSX machine and keep
I'm trying to run some nodejs apps in Notepad++ . I installed NppExec and
I'm a student, and I'm trying to write and run some test code for
I'm trying to run a .exe that requires some parameters by using system(). If

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.