SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    $this->toCD-R(LP); vinyl-junkie's Avatar
    Join Date
    Dec 2003
    Location
    Federal Way, Washington (USA)
    Posts
    1,524
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Another php.ini question

    I've read this thread, so I know what php.ini is and also where it is on my server. Carrying this a step further, php.ini isn't something I can access to edit.

    In PHP Anthology 1, Harry has a discussion on page 105 regarding the use of the PEAR DB_DataObject, and gives a chunk of code which must, to quote, "obey the same formatting rules as php.ini." Here is the code:
    Code:
    [DB_DataObject]
    ; PEAR::DB DSN
    database    = mysql://harryf:secret@localhost/sitepoint
    ; Location where sitepoint.ini schema file should be created
    schema_location = /htdocs/phpanth/SPLIB/ExampleApps/DataObject
    ; Location where DataObject classes should be created
    class_location  = /htdocs/phpanth/SPLIB/ExampleApps/DataObject
    ; Prefix for including files from your code
    require_prefix  = ExampleApps/DataObject
    ; Classes should be prefixed with this string e.g. DataObject_User
    class_prefix    = DataObject_
    ; Debugging information: 0=off, 1= display sql,2=display results, 3=everything
    debug = 0
    ; Prevent SQL INSERT, UPDATE or DELETE from being performed if true
    debug_ignore_updates = false
    ; Whether to die of error with a PEAR_ERROR_DIE or not
    dont_die = false
    So the question is this: How do I pull that into my application, given that I can't edit php.ini?

    Secondly, there is code that follows this which Harry says must be run from the command line. Here's the code:
    Code:
    <?php
    // Builds the DataObjects classes
    $_SERVER['argv'][1] = 'db_dataobject.ini';
    require_once('DB/DataObject/createTables.php');
    ?>
    I don't have command line access and can't get it. Will this run as a web page?
    Music Around The World - Collecting tips, trade
    and want lists, album reviews, & more
    Showcase your music collection on the Web

  2. #2
    ********* Wizard silver trophy Cam's Avatar
    Join Date
    Aug 2002
    Location
    Burpengary, Australia
    Posts
    4,495
    Mentioned
    0 Post(s)
    Tagged
    1 Thread(s)
    The config isn't supposed to go in php.ini, it's supposed to be saved at db_dataobject.ini as per the second code block And I can't comment on whether it'll work as a file except to tell you to give it a shot. Do you have access to exec()? If so, then try saving that script and then putting this in another file.
    PHP Code:
    $rs = `php -f /path/to/file.php`; # note backticks
    print_r($rs); 
    ...and see if that works

  3. #3
    $this->toCD-R(LP); vinyl-junkie's Avatar
    Join Date
    Dec 2003
    Location
    Federal Way, Washington (USA)
    Posts
    1,524
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Well, I guess none of this really matters, because I'm just not going to be able to run that code as a web page. I tried, didn't get any errors, but then it didn't work either. That could be because I don't really know what I'm doing (entirely possible, since PEAR is new stuff to me), but more likely isn't running because it needs to run as a shell command.

    Thanks for trying to help.
    Music Around The World - Collecting tips, trade
    and want lists, album reviews, & more
    Showcase your music collection on the Web


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •