$connection = ssh2_connect($SFTP_SERVER, 22);
ssh2_auth_password($connection,$SFTP_USERNAME,$SFTP_PASSWORD);
$sftp = ssh2_sftp($connection);
Fatal error: Call to undefined function ssh2_connect() in /var/www/html/beta/0sftp.php on line 33
my system is CentOS 6.4 all the required extensions is installed but I don't know how to verify.
try to run the command :
yum install php-pecl-ssh2
For whatever it is worth, I tested the installation from the command line
php -i | grep ssh
and it was OK, but it did not work in a web page; took me a couple of minutes to remember I have to re-start Apache after installation :)
Related
I transfer Laravel to VPS and get the following error:
Fatal error: Uncaught Error: Call to undefined method ComposerAutoloaderInit13c2409cfa32d1fa0c04493c0d85c93c::getLoader() in /var/www/site.ru/application/vendor/autoload.php on line 7
Error: Call to undefined method ComposerAutoloaderInit13c2409cfa32d1fa0c04493c0d85c93c::getLoader() in /var/www/site.ru/application/vendor/autoload.php on line 7
PHP 7.4
I do composer dump-autoload and still no changes
Please help!)
git clone ...
composer install
Don't work.
Remove vendor and
composer install
Don't work.
For my case, symfony server:start and php -S both get the undefined method errors. I've uopz installed for testing. Disable the extension, and the error goes.
You have to disable uopz extension and restart apache :
phpdismod uopz
systemctl reload apache2
1 - you need to update php to a newer version (php 7.4.3 or above)
2 - use the composer from the official site (it's better to download it as a file)
In my case, everything worked the first time. I have Linux Mint 20, php 7.4.3, Laravel 7
If you have Linux Mint 20, then to install php7.4.3 you need to change mirros in Software Sources. In my case, I disable the repository from ondrej/php and changed mirros. Next install php
I am using PHP 7.0 with Apache2 in Ubuntu trusty.
I have installed the STOMP library doing
wget http://pecl.php.net/get/stomp-2.0.0.tgz
pear install stomp-2.0.0.tgz
And adding extension=stomp.so to my php.ini.
With phpinfo() I can see the Stomp installed correctly:
But I have this script:
<?php
$foo = new Stomp('tcp://localhost:61613');
And When I run this error is shown:
PHP Fatal error: Uncaught Error: Class 'Stomp' not found in
/vagrant/www/web/activemq-server.php:3 Stack trace:
0 {main} thrown in /vagrant/www/web/activemq-server.php on line 3
UPDATE:
This problem happens only when the script is run from console. If the script is run from browser then it works correctly.
Did you add the extension to php.ini for the CLI too ?
You can type " php -i | grep -i stomp " in the console to know if the extension is enabled
Check the namespace.
$foo = new \Stomp('tcp://localhost:61613');
How to fix this error:
Fatal error: Call to undefined function ctype_alnum() in /Applications/AMPPS/www/farhom.com/magento18/lib/Zend/Uri.php on line 109
I was trying to run Magento on Ampps on Mac OS X.
Open Ampps Application -> PHP Tab -> PHP Extension -> Select "ctype" -> Apply.
Restart Apache server.
Forum with answer posts
Check to make sure the ctype package is installed; It's typically installed by default but some distros exclude it.
For Alpine:
apk add php7-ctype
I've installed on my MAC MAMP 3.0.2 and I used PHP 5.4.25 .
This is my phpinfo:
I've already installed APC, and this is the APC page that MAMP show me:
I'm trying to run the follow php script:
<?php
$bar = 'BAR';
apc_store('foo', $bar);
var_dump(apc_fetch('foo'));
?>
but, when i run this script by command line I've the following error:
Fatal error: Call to undefined function apc_store() in /Users/xxxxxxxxx/htdocs/prova.php on line 3
What's wrong?
--
Thanks
When running PHP scripts from the CLI you will need to specify the PHP binary you want to use since by default php will be the default PHP included with OS X, not the one installed with MAMP.
So instead of:
user$ php script.php
try:
user$ /Applications/MAMP/bin/php script.php
Obviously you will need to adjust the above with the path to where the MAMP PHP binary is located.
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.