I follow the solution of PHP Fatal error: Class 'OAuth', but still get the same error.
installation
$ sudo pecl install oauth
then add the following line to the end of /etc/php/7.0/cli/php.ini
extension=/usr/lib/php/20151012/oauth.so
Both "php -m" and "php --re oauth" return something. But "php -z" does not work and no OAuth from phpinfo() either.
$ php -z oauth /var/www/html/oauth.php
Failed loading oauth: oauth: cannot open shared object file: No such file or directory
PHP Notice: Undefined index: HTTP_HOST in /var/www/html/oauth.php
One thing to note, I am running PHP on apache2 as docker container behind nginx proxy. Would that be a problem? I verify PHP via phpinfo(), which is working fine.
The system is Ubuntu 16.04, also.
$ pecl list
Installed packages, channel pecl.php.net:
=========================================
Package Version State
oauth 2.0.2 stable
Thanks for the help.
The $_SERVER['HTTP_HOST'] only exists when run php as web server or cgi mode. So if you run in cli mode, the $_SERVER does not contain HTTP_HOST index. Try to access a not exiting index will throw a notice.
Otherwise, if a request is over ip rather than host, this index would not exist.
Related
I'm running PHP 7.4.3 and NGINX 1.18.0 on Ubuntu 20.04
I followed the instructions at https://cloud.google.com/php/grpc to install gRPC.
When I run php -m, "grpc" is in the list of PHP Modules.
Ultimately, my site resolves in a 500 error with the following entry in /var/log/nginx/error.log:
FastCGI sent in stderr: "PHP message: PHP Fatal error: Uncaught Google\Cloud\Core\Exception\GoogleException: The requested client requires the gRPC extension. Please see https://cloud.google.com/php/grpc for installation instructions. in /vendor/google/cloud-core/src/ClientTrait.php:75
As far as I can tell, gRPC is installed. I know of no other ways to validate its presence.
Running php from the cmdline usually uses a different php.ini file to what the webserver uses.
To verify the presence of a module, you would need to create a page on the website to verify the module exists
<?php
phpinfo();
As a side note, if it is a public website, don't call the file phpinfo.php and be sure to remove it after you have checked the output, as it is a security risk to expose that information about your server.
I tried to install ZMQ for PHP recently and ran into the following problem:
apache2: Syntax error on line 137 of /etc/apache2/httpd.conf: Cannot
load modules/extra_zmq.so into server:
/usr/lib64/apache2/modules/extra_zmq.so: undefined symbol:
zend_new_interned_string
I followed the steps to install 0mq and everything went fine: http://www.zeromq.org/intro:get-the-software
I ran needed commands to make php-zmq: http://zeromq.org/bindings:php
Just to be sure I configured with php config set: phpize && ./configure --with-php-config=/usr/bin/php-config
make test on php-zmq shows my PHP version is used (7.1.11, along with Zend 3.1.0) and fail for these two tests (don't know if it's related, I couldn't find more information about these tests):
FAILED TEST SUMMARY
---------------------------------------------------------------------
Test adding / removing items [tests/007-addremovepoll.phpt]
Test callback edge-cases [tests/019-callbackinvalidsignature.phpt]
I tried downloading from both Github and PECL repository without any luck.
Well I found the problem, the extension was meant to be loaded by PHP and not by Apache.
I was trying to use LoadModule (a2enmod) in httpd.conf, but this extension needs to be used with PHP, with the proper directive: extension=zmq.so.
I have purchased a VPS in Dreamhost. Now Im trying to run php composer.phar install but it says:
Fatal error: Class 'Phar' not found in
/home/john/mysite.com/composer.phar on line 13
Since I have found out that I have these directories:
/usr/local/php /usr/local/php53 /usr/local/php54
and, for example, in /usr/local/php53/bin/ I have this:
phar phar.phar php php-cgi php-config phpize
,how can I run php composer.phar install without errors?
If you need more information about content in folders I will give it of course.
This works for me:
php -d extension=phar.so composer.phar [... your command ...]
This includes the phar extension for the current runtime. Works for shared / VPC servers.
It looks like you might not have the phar extension installed or configured correctly. It might be worth checking the output of a call to phpinfo().
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 want to install php5 on my mac using macports. It throws the following error on terminal:
Attempting to fetch php5-5.3.12_0+apache2.darwin_11.x86_64.tbz2.rmd160 from http://packages.macports.org/php5
Error: org.macports.archivefetch for port php5 returned: Failed to verify signature for archive!
Please see the log file for port php5 for details:
/opt/local/var/macports/logs/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_lang_php5/php5/main.log
To report a bug, follow the instructions in the guide:
http://guide.macports.org/#project.tickets
Error: Processing of port php5 failed
What should I do?