I want to use snmp class on PHP, and try that example-1 on my server.
<?php
$session = new SNMP(SNMP::VERSION_1, "127.0.0.1", "public");
$sysdescr = $session->get("sysDescr.0");
echo "$sysdescr\n";
$sysdescr = $session->get(array("sysDescr.0"));
print_r($sysdescr);
?>
when I execute this I get this error:
PHP Fatal error: Class 'SNMP' not found in /var/www/wls/wtest.php on line 2
I installed snmp and php with yum:
yum install httpd php php-devel php-snmp net-snmp
I also tried to find cause but i found just about library and my server info:
php-5.3.3-14.el6_3.x86_64 php-snmp-5.3.3-14.el6_3.x86_64 net-snmp-5.5-41.el6_3.1.x86_64
I think the reason must be so simple but I couldn't found it,
Thanks for your help.
The SNMP class is only available in PHP 5.4 and higher, for PHP 5.3 and lower and you have to use the SNMP functions instead, http://php.net/manual/en/ref.snmp.php.
Restart Apache.
Check that php-snmp.so is listed in extensions.ini.
Check if there's a section for php-snmp in phpinfo().
Check your server's logs.
Related
I've got stuck with using of GD library.
I have installed and enabled at php.ini (extension=gd2) the library but when I try to use it I'm getting the error: Call to undefined function App\Http\Middleware\imagecreatefromjpeg().
They say that it should be used --with-jpeg-dir flag. How do I add this flag to Configure Command like at the screenshot attached?
Check out this thread on a similar topic.
StackOverflow: imagecreatefromjpeg and similar functions are not working in PHP
This was Laravel project and there's an ability to run the site using 'php artisan serve' command which starts its own(in-built) Apache and this Apache doesn't have GD installed.
It needs to set up virtual host for the purpose.
I'm attempting to install the Trader extension on my mac. I believe the install was done correctly but can't seem to use them. Here is my feedback from terminal
sudo pecl install trader
pecl/trader is already installed and is the same as the released version 0.4.0
install failed
Based on that it shows that I have installed it. But here is what I get when trying to use one
Uncaught Error: Call to undefined function trader_cci()
Anybody have tips on a step I may have missed?
Thanks in advance!
Did you include the extension in your php.ini file? You will need to add the following line in the correct ini (depends on if you use it on the command line or via FPM) to tell PHP that it needs to load the installed extension
extension=trader.so
My idea is to use reactjs with serverside rendering in PHP. I run and install with success php55-v8js using homebrew. the path of installation is /usr/local/Cellar/php55-v8js/0.4.0_2
in my application I tried to use V8 but with no success. the message displayed is:
Fatal error: Class 'V8Js' not found in
/Applications/AMPPS/www/phpreact/index.php on line 14.
on line 14 the following code is displayed: $v8 = new V8Js();
my main question is: do we have to call v8 through a require_once/file_get_contents->toPath or similar? or homebrew installation make v8 available globally on the OS system?
If you installed the V8 PECL extension correctly, you also need to turn on the extension in your .ini file and restart your PHP server.
I have a fresh Ubuntu 12.04 installation with a basic web server setup including pecl and OAuth; However, when I run a simple index file (as shown below) I am getting a fatal error:
PHP Fatal error: Class 'OAuth' not found in /var/www/index.php on line 2
Here is my file:
<?php
$oAuth = new \OAuth(CONSUMER_KEY, PRIVATE_KEY);
Obviously the consumer/private keys are my actual keys.
Now I have checked phpinfo() and OAuth is definitely in there. I have it set in my php.ini. I have restarted Apache.
When I run pecl list
Installed packages, channel pecl.php.net
Package Version State
oauth 1.2.3
stable pecl_http 1.7.6 stable
extension_loaded('oauth') // returns true
there's no oAuth in php -m either
Any ideas why I am still getting class not found? I hope it's not something dumb I am missing :)
Cheers guys.
I got this error saying:
Fatal error: Class 'SoapClient' not found in ....php file. Do I have to install/include the SoapClient manually? Isn't it a builtin php module?
Update:
If I am using wordpress, how can I get soapclient installed?
Thanks.
It depends on how you installed PHP.
If PHP was built from source, you have to rebuild it with the --enable-soap option per http://php.net/manual/en/soap.installation.php.
If you installed a binary package via a package manager in your distro, check if you can find any php5-soapclient-packages or similar and install those.
Tested on Debian wheezy, php5-cli includes SoapClient() by default.
No, it isn't installed by default. You need to install PHP with --enable-soap option.
Read more here http://php.net/manual/en/soap.installation.php