Bitnami LAMP PHP Error log issue

Home Forums BulletProof Security Pro Bitnami LAMP PHP Error log issue

Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • #37576
    Ljubomir Manojlovic
    Participant

    I have problem as I set one server with LAMP stack and multiple WP modules. As they all share same /opt/bitnami/php/etc/php.ini file, BPS is not able to read correctly multiple log files. So I set ie

    error_log = /opt/bitnami/apps/mydomain/htdocs/wp-content/bps-backup/logs/bps_php_error.log
    error_log = /opt/bitnami/apps/mydomaintwo/htdocs/wp-content/bps-backup/logs/bps_php_error.log
    error_log = /opt/bitnami/apps/mydomainthree/htdocs/wp-content/bps-backup/logs/bps_php_error.log
    error_log = /opt/bitnami/apps/mydomainfour/htdocs/wp-content/bps-backup/logs/bps_php_error.log

    and BPS always (for all sites) read only last (mydomainfour) path.

    What to do?

    #37577
    AITpro Admin
    Keymaster

    You can only setup 1 PHP error log per site at a time in the PHP Error Log feature.  If you want to be able to view multiple PHP Error Log files then you would need to use the File Manager and File Editor features.  You can of course only view 1 PHP error log file at a time using the File Editor feature.

    I don’t completely understand your other questions.  So I am making a logical guess that you have a folder or file permissions or Ownership issue.  If a file is Read only then there is a folder or file permissions or Ownership problem occurring then you would need to check and make sure that the Owner of a folder is the same Owner for ALL of your other WordPress folders.  If a folder has a different Owner then you need to use CHOWN to change the Owner to the same Owner that ALL of your other WordPress folders have.  If it is a folder or file permissions issue then you need to use CHOWN or FTP or a file manager tool and change the folder or file permissions to the correct permissions for Read and Write capability.

    Or maybe you are saying that the error_log directive in your php.ini file is only making the last error_log directive available to your PHP configuration, which would make sense.  I am pretty sure that you can only have 1 error_log directive in a php.ini file.  If that is the problem that is occurring then the solution is to create custom php.ini files per website and each separate custom php.ini file would have only 1 error_log directive with the path to the PHP error log file.

    You can of course just have 1 PHP error log for all of your websites.

    If you have several websites under your hosting account and you want to use only 1 php error log to log all errors for all of your websites then you will want to use one folder location on one website for your one PHP Error log. For all of your other websites under your hosting account you will copy and paste the Error Log Path Seen by Server: folder path to the PHP Error Log Location Set To: text box on each of your websites where you want to log php errors to that 1 php error log file.

    #37582
    Ljubomir Manojlovic
    Participant

    “Or maybe you are saying that the error_log directive in your php.ini file is only making the last error_log directive available to your PHP configuration, which would make sense. ”

    Yes, that is the issue.

    ” If that is the problem that is occurring then the solution is to create custom php.ini files per website and each separate custom php.ini file would have only 1 error_log directive with the path to the PHP error log file.”

    And how to do it? I searched Bitnami docs and couldn’t find nothing like that.

    #37583
    AITpro Admin
    Keymaster

    Every web host has different custom php.ini setup requirements.  There is no “one size fits all” setup instructions for custom php.ini files, but in general the server needs to be configured to recognize additional custom php.ini files and if the server can recognize additional custom php.ini files already then you would copy the /opt/bitnami/php/etc/php.ini file to the root folder (folder where the WordPress site is installed) for each website and then make editing changes (add the error_log directive file path to the PHP error log) in each custom php.ini file.  Note:  In order for php.ini server configuration changes to take effect the server needs to be rebooted.

    #37584
    Ljubomir Manojlovic
    Participant

    Thanks, I did that, but there is still error > PHP Error Log Path Does Not Match

    Recommended path is equal to ‘PHP Error Log Location Set To:‘, but ‘Error Log Path Seen by Server:‘ is empty (for me logical, as server php.ini is empty now).

    So, what about this situation now? Error log count or not (there is not even option to remove it – at least I can’t see option)?

    #37585
    AITpro Admin
    Keymaster

    Binami uses .user.ini files for a custom php.ini files > https://community.bitnami.com/t/solved-how-can-i-use-a-local-php-ini-in-azure-wp-stack/50140/2
    Note: When a .user.ini file is used your server will look at both the server’s default php.ini file and the .user.ini file. If the error_log directive is configured in the server’s default php.ini file and in your .user.ini file for each website then each website will use the error_log directive setting for that site. The end result is cumulative and hierarchical.

    Looks like I solved this issue.

    For reference, here is what was required:

    1. Edit /opt/bitnami/php/etc/php.ini and remove the semi-colon from line with, user_ini.filename = ".user.ini"
      In an unmodified php.ini this is line 175.
    2. Also remove the semi-colon from line with, user_ini.cache_ttl = 300
      In the default Bitnami php.ini, this is line 181
    3. Restart apache and php-fpm (no idea if both need restarting, but that’s what I did).
      sudo /opt/bitnami/ctlscript.sh restart apache
      sudo /opt/bitnami/ctlscript.sh restart php-fpm

    Use .user.ini as the file name for your custom php.ini files. I suppose line 175 (in above instructions) could be set to use php.ini as the user php filename, but I suspect it’s more secure when it’s a hidden file, as is the case for .user.ini.

    #37588
    Ljubomir Manojlovic
    Participant

    It is certainly better solution (it works), but still not solve ‘PHP Error Log Path Does Not Match’, as BPS compare correct application path with server path (not exists, as I pointed above).

    So, what about that?

    #37589
    AITpro Admin
    Keymaster

    You would add the PHP error log path to your php error log in the “PHP Error Log Location Set To” text box and click the Set Error Log Location button.  If your PHP error log is working then you can just turn off the BPS “PHP Error Log Path Does Not Match” alert on the BPS > S-Monitor page > PHP Error Log: Check Folder Path Location Alert > Turn Off Displayed Alerts.

    #37590
    Ljubomir Manojlovic
    Participant

    Yes, I wrote how Recommended path is by user.ini now set in order, but logically cannot be compared with server path as I cannot set it vs multiple modules. So, I asked for PHP Error Log: Check Folder Path Location Alert and thanks also for that. Now is all set in order in Bitnami with multiple modules (hopefully will be useful for somebody).

    Thanks again for great support.

Viewing 9 posts - 1 through 9 (of 9 total)
  • You must be logged in to reply to this topic.