Results 1 to 4 of 4

Thread: Apache & PHP: how to PHP show errors for just one domain?

  1. #1
    Join Date
    Apr 2013
    Beans
    8

    Apache & PHP: how to PHP show errors for just one domain?

    Hello,


    I'm running more websites at my Ubuntu 12.04 server. Most of them are php-based websites.

    I have one testdomain at my ubuntu server where I test the php-scripts while I am creating the scripts/website. Unfortunatly the testdomain doesn't tell if I made some syntax errors.

    Is there a way to switch on the php error messages for this testdomain only?

    Kevin

  2. #2
    Join Date
    Nov 2008
    Location
    Kingdom of cookies
    Beans
    Hidden!
    Distro
    Ubuntu Development Release

    Re: Apache & PHP: how to PHP show errors for just one domain?

    If you are using php+fpm....

    You can add php settings to /etc/php5/fpm/pool.d/*

    There are a few examples at the end of how the php setting should be formatted

    If you are using Apache, use the php_admin_value directive (e.x. php_admin_value upload_max_filesize 50M) to set php settings
    Ubuntu Forums Moderation Staff || SandyDNET
    Twitter: @CatchesAStar | Last.fm
    Ubuntu Membership via Forum Contributions

  3. #3
    Join Date
    Nov 2008
    Location
    Metro Boston
    Beans
    8,840
    Distro
    Kubuntu 14.04 Trusty Tahr

    Re: Apache & PHP: how to PHP show errors for just one domain?

    First, I'd set the Apache ErrorLog directive for the testdomain to a separate log file in /var/log/apache2 if you haven't done so already. I usually just "tail" this file in a terminal window while debugging the website code. However if you want to enable the display of error messages within the page, add these to the top of your index.php script:

    Code:
    error_reporting(E_ALL);
    ini_set( 'display_errors','1');
    All my PHP sites include an initialization script before any content is displayed, so I would put these commands in that. Otherwise you need to put them at the top of index.php and any other .php pages.

    In versions of PHP starting with 5.2.4, you would replace '1' with 'stdout' in the ini_set() function.
    Last edited by SeijiSensei; June 12th, 2013 at 03:15 AM.
    If you ask for help, please have the courtesy to check for responses and thank the people who helped you.

    Blog · Linode System Administration Guides · Android Apps for Ubuntu Users

  4. #4
    Join Date
    Apr 2013
    Beans
    8

    Re: Apache & PHP: how to PHP show errors for just one domain?

    Thanks all!

    I prefere the idea SeijiSensei gave. I working with it for a few weeks and it works fine for me.

    Thanks again!
    Kevin

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
  •