Ubuntu typing 'php' in terminal shows a lot of errors

前端 未结 10 2139
粉色の甜心
粉色の甜心 2020-12-07 15:17

I\'m using Ubuntu 13.10 and php is installed and working perfectly. But, when I type php in the terminal, it lists a lot of errors (and after that, it goes to w

相关标签:
10条回答
  • 2020-12-07 15:50

    this error display in cacti poller error logs when snmp-mibs-downloader not installed

    vim /etc/apt/sources.list

    add to sources "non-free" packages

    apt-get update apt-get install snmp-mibs-downloader /etc/init.d/apache2 restart

    0 讨论(0)
  • 2020-12-07 15:54

    Try to update packages:

    sudo apt-get update
    sudo apt-get upgrade
    /etc/init.d/apache2 restart
    

    and if it not help, try to reinstall php

    sudo apt-get remove --purge php5
    sudo apt-get install php5
    /etc/init.d/apache2 restart
    
    0 讨论(0)
  • 2020-12-07 15:55

    These warning messages appear because the PHP init can not find the mod config in the user dir. So you have to do the following steps:

    1) edit your etc/php/{yourversion}/mods-available/snmp.ini and comment or delete the following strings:

    ; configuration for php snmp module
    ; priority=20
    ;extension=snmp.so
    ~                                                                                                                                                                                                                  
    ~   
    

    2) run apt-get --purge remove php-snmpt

    0 讨论(0)
  • 2020-12-07 15:56

    I spent a few hours on this and wanted to share how I solved it in case someone searches for this error and still needs to use php-snmp module (removing that module also removes the error). /etc/snmp/snmp.conf has a setting: mibs ALL

    This tells the net-snmp library to attempt to load every mib file. If you do not need this you can comment that out and the errors are gone. If you still want to load every mib file continue reading.

    In ubuntu 16.04 setting the environment MIBDIR to /usr/share/mibs stopped these errors for me. I needed this to happen on every session for php CLI runs so I created /etc/profile.d/mibs.sh with: export MIBDIRS=/usr/share/mibs

    No more php errors from CLI.

    To disable the error for cronjobs I added the same ENV in the cron file where the errors were happening.

    If someone knows why not setting MIBDIRS causes these errors, I would love to hear. I can only assume the default for this in net-snmp are not compatible with ubuntu 16.04 mibs downloader.

    0 讨论(0)
  • 2020-12-07 15:58

    For those of us that need the php5-snmp package, the above may not solve your problem. In that case you can try:

    sudo apt-get install snmp
    

    which will install snmp for you, which seems to be required for the php5-snmp package to avoid outputting those errors.

    0 讨论(0)
  • 2020-12-07 16:00

    If you're using php 5. Simply remove php5-snmp package

    sudo apt-get remove php5-snmp
    

    If you're using php 7. Remove php7.0-snmp package.

    sudo apt-get remove php7.0-snmp
    
    0 讨论(0)
提交回复
热议问题