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');
Related
So I am creating a website for my virtual airline for xplane-11, and I came across this error:
Fatal error: Uncaught Exception: Required GD library is missing in /var/www/html/vam/captcha/simple-php-captcha.php:13 Stack trace: #0 /var/www/html/vam/index.php(15): simple_php_captcha() #1 {main} thrown in /var/www/html/vam/captcha/simple-php-captcha.php on line 13
I have libgd-dev installed on my ubuntu 20.04 and I also have all the extensions uncommented in my php.ini file in the etc/apache2/sites-available folder. I am really frustrated at this point and any help given will be thanked.
From the command line what do you get if you run
php -m | grep -i gd
If it returns
gd
Then the module is included and running in your version of PHP.
Otherwise I would try the following
apt-get install php-gd
Then run the php -m | grep -gd command again after restarting apache
I have launched a PHP based web application in AWS EC2 instance using ubuntu 16.04. I need to add some cron jobs for executing php file having curl feature. But while testing, the php shows following error while executing through command line:
PHP Fatal error: Uncaught Error: Call to undefined function curl_init() in /var/www....php
but when I try to call the exact file through browser, it works perfectly.
I have checked php.info and it shows curl is enabled. Then I execute " php -m " command in terminal. It does not show curl among the list.
I opened the php.ini file, and enabled the php-curl extension which was commented out. But still its not executing through command line.
Previously in AWS EC2 I used ubuntu 14.04 and there I have not faced this problem at all.
Can anybody help me on this problem? Thanks in advance.
I have found the solution.
It looks like I have installed both php7 and php5.6. As I am working with php 5.6, I have enabled all its module but not in php7.0. The command ' php ' is set to php 7 cli. So for using version 5.6 I have to use command ' php5.6 ' instead of ' php ' for executing files
so the command will be like:
php5.6 /var/www....php
I'm using Xampp to run a php file using Brackets. I got this error:
PHP Fatal error: Call to undefined function json_decode() in Xampp
I don't know if this is related but I checked the php info file and there are no disabled files. In the json section it says support enabled, json version 1.4.0. In the ini file I searched for json but couldn't find anything.
How can I resolve this error?
if you are on Ubuntu use the following command in command line shell
sudo apt-get install php5-json
if you are on windows, edit php.ini and enable the json extension.
I am trying to setup Codeception (v1.8) on my local development box (Windows 7 running WAMP).
I have PHP 5.3.13 running and both CURL and bzip2 are enabled modules, when I run the following command to install the 'framework' I get the following error:
php codecept.phar bootstrap
PHP Fatal error: Uncaught exception 'PharException' with message 'bz2 extension is required for bzip2 compressed .phar file "C:\wamp\www\codecept\codecept.phar"' in C:\wamp\codecept\codecept.phar:3
Stack Trace:
#0 C:\wamp\www\codecept\codecept.phar(3): Phar::mapPhar()
#1 {main}
thrown in C:\wamp\www\codecept\codecept.phar on line 3
......
I have 5.3 running so haven't installed the latest version of Codecept (v2) as that doesn't work with my version of PHP but cannot be sure why this is happening?
Any ideas
P.S I will be using this Codecept with Yii eventually if that makes any difference
I had the same problem and uncommenting 'extension=bz2.so' in my php.ini file fixed it.
the problem you have is because the v2 of codeception requires at least php5.4, downgrade to some of the 1.x versions than you will have no problem.
Here is the link for the versions
$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 :)