Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 8 of 8
  1. #1
    New Coder
    Join Date
    May 2004
    Posts
    38
    Thanks
    0
    Thanked 0 Times in 0 Posts

    php.ini – Sessions locally? and display_errors...

    I've got a test server set up on my Mac with PHP5 and mySQL, and I've got two problems that I believe can be solved through the PHP settings on my local machine.

    First, the new buld of PHP seems to default the 'display_errors' setting in PHP to 'Off', and I'd like to turn it on. I've found several online posts about how to edit your php.ini file, and I've gone in the edited my php.ini file and changed the 'display_errors' to 'On', and uncommented the line, yet it still does not work. If anyone knows how to fix that, or have any ideas of what I might have done wrong, that'd be great.

    And then I'm working with a login/admin setup that I'd like to test locally, but sessions does not seem to work on my machine. It works when I upload it via FTP to my hosting server, but not locally. I'm thinking that there might be a setting for this in my php.ini file as well. Anyone have any ideas?

    Thanks...

  • #2
    fci
    fci is offline
    Senior Coder
    Join Date
    Aug 2004
    Location
    Twin Cities
    Posts
    1,345
    Thanks
    0
    Thanked 0 Times in 0 Posts
    did you restart apache after changing your php.ini?
    the php.ini is usually well commented, so you could look through it and see what to change. you could also run this on your host:
    Code:
    <?php phpinfo(); ?>
    and you can find all the settings they have set and just mimic those in your php.ini

  • #3
    New Coder
    Join Date
    May 2004
    Posts
    38
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Yea, I restarted Apache, and checking my phpinfo() was what brought it to my attention that the 'display_errors' parameter was set to Off in the first place. I changed it to 'On' in my php.ini—I did remove a '; - ' from the beginning of that line in the php.ini, was I not supposed to do that? Other than that I'm not really sure why it's not working? Anyone have any other ideas? Thanks...

  • #4
    Super Moderator
    Join Date
    May 2002
    Location
    Perth Australia
    Posts
    4,095
    Thanks
    11
    Thanked 101 Times in 99 Posts
    are you sure you are editing the right php.ini ? check the output of phpinfo() for 'Configuration File' , if its not a full path e.g /etc/php.ini (not a clue where that would be on a mac) then php can't find the file and is working on built-in defaults , if there is a full path , is that the file you are actually editing ?
    resistance is...

    MVC is the current buzz in web application architectures. It comes from event-driven desktop application design and doesn't fit into web application design very well. But luckily nobody really knows what MVC means, so we can call our presentation layer separation mechanism MVC and move on. (Rasmus Lerdorf)

  • #5
    New Coder
    Join Date
    May 2004
    Posts
    38
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Yes, I was editing the file that shows up in my phpinfo(), which was at /usr/local/php5/lib/php.ini . This was my exact process in the terminal:

    sudo pico /usr/local/php5/lib/php.ini - enter
    password...
    Ctrl-W and search for 'display_errors'

    changed this: ; - display_errors = Off [Security]
    to this: display_errors = On [Security]

    then ctrl-O to save it.

    The change still seems to be present even when i reopen the php.ini file, or restart apache, but still says 'Off' in my phpinfo() file. Any more ideas? I know this is just nuts...

  • #6
    fci
    fci is offline
    Senior Coder
    Join Date
    Aug 2004
    Location
    Twin Cities
    Posts
    1,345
    Thanks
    0
    Thanked 0 Times in 0 Posts
    how about typing the following from a shell:
    Code:
    locate php.ini
    hopefully that'll list all locations of your php.ini.
    if that fails (or OS X doesn't come with locate, I have no idea if it does), try:
    Code:
    find / -name php.ini

  • #7
    Super Moderator
    Join Date
    May 2002
    Location
    Perth Australia
    Posts
    4,095
    Thanks
    11
    Thanked 101 Times in 99 Posts
    I dont think it makes a difference but lose the [Security] bit & check that that directive is not duplicated elsewhere in the php.ini ...

    also check that error_reporting is actually turned on in the first place , e.g
    error_reporting = E_ALL & ~E_NOTICE

    as a last resort , edit your httpd.conf file and add ...
    Code:
    php_admin_value  display_errors  on
    resistance is...

    MVC is the current buzz in web application architectures. It comes from event-driven desktop application design and doesn't fit into web application design very well. But luckily nobody really knows what MVC means, so we can call our presentation layer separation mechanism MVC and move on. (Rasmus Lerdorf)

  • #8
    New Coder
    Join Date
    Jul 2005
    Posts
    62
    Thanks
    0
    Thanked 0 Times in 0 Posts
    You're changing the wrong thing - the first instance of "display_errors" is for documentation purposes. If you go further down the file, you will find a second one, which is the one you have to change.


  •  

    Posting Permissions

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