When I attempt to run a PHP file containing mysqli functions through command line it throws an error like Fatal error: Uncaught Error: Call to undefined function mysqli_connect()
The same file runs perfectly through the built-in web station app so naturally, I tried running it with the -c parameter and specifying the same file that PHP is run with through the web station app:
php -c /usr/local/etc/php73/cli/php.ini /volume1/web/test.php
But I still get the same error so I am at a loss as to what the issue could be here
Synology Diskstation has a concept of packages. PHP packages are installed with a specific version number. When you want to use the same setup that you have in Web Station you must use the appropriate PHP version.
If you are using PHP 7.3 package then try executing it with php73
php73 /volume1/web/test.php
Related
When I attempt to run a PHP file containing mysqli functions through command line it throws an error like Fatal error: Uncaught Error: Call to undefined function mysqli_connect()
The same file runs perfectly through the built-in web station app so naturally, I tried running it with the -c parameter and specifying the same file that PHP is run with through the web station app:
php -c /usr/local/etc/php73/cli/php.ini /volume1/web/test.php
But I still get the same error so I am at a loss as to what the issue could be here
Synology Diskstation has a concept of packages. PHP packages are installed with a specific version number. When you want to use the same setup that you have in Web Station you must use the appropriate PHP version.
If you are using PHP 7.3 package then try executing it with php73
php73 /volume1/web/test.php
I installed laravel project 5.1 which is working fine but artisan commands are not working throwing each() error which is deprecated in php 7.1. When I run phpinfo() it shows php version 5.6 and on command line there's also two versions are showing
when run
phpinfo();
5.6
when run on command Line in xampp folder
C:/xampp> php -v;
5.7
when run in command in this xammpp/php directory
C:/xampp/php> php -v;
5.6
This is because there are CLI version and WEB version.
How Giacomo1968 says in this answer on Super User:
“Don’t panic! If you are concerned about what PHP version your Apache server is using, the output of phpinfo() is always what you should pay attention to. The Apache PHP module and the PHP command line binary are two different things that don’t interfere with each other.
In fact you can compile and load various PHP versions you want to work with Apache as long as you adjust Apache to properly load it. The PHP command line interface will never come into play in the case of Apache parsing PHP pages.
The command line version of PHP is simply there for command line specific tasks and the PHP module for Apache will never touch, use or need that.”
I've been trying to install a php 5.6 driver for mongodb on Ubuntu 12.04. (Will be using this on a Zend Framework 1.11 system, yes this is old, I am fully aware).
I've tried a few things, nothing works.
It seems I should get it to work using this installation:
http://php.net/manual/en/mongodb.installation.manual.php
But for some reason at the make all -j 5 step I get the following error:
In file included from /var/mongotest/mongo-php-driver/src/bson.c:29:0:
./phongo_compat.h:21:30: fatal error: Zend/zend_string.h: No such file or directory
compilation terminated.
In file included from /var/mongotest/mongo-php-driver/src/bson-encode.c:29:0:
./phongo_compat.h:21:30: fatal error: Zend/zend_string.h: No such file or directory
Just install php5.6-dev, it includes all the header files.
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 have PHP 5.4 on a litespeed web server. PHP has been compiled properly with memcached module and we also installed properly memcached library.
In fact the problem suddenly happened without any change at all (server side) when I run the artisan command, I am getting this error:
PHP Fatal error: Class 'Memcached' not found in /laravel/vendor/laravel/framework/src/Illuminate/Cache/MemcachedConnector.php on line 52
[Symfony\Component\Debug\Exception\FatalErrorException]
Class 'Memcached' not found
I googled the issue but was unable to find a solution. I am using Laravel 5.0.
I edited the app/Http/Routes.php and returned new Memcached at the top of the file and the php object was returned so it means memcached is properly installed on the server...
Any help would be appreciated.
Found the solution. My problem was when I was running the artisan command, the artisan was using another version of PHP (different than the Litespeed one) and this PHP was not compiled with memcached.