pg_connect error when using php-cli - php

I recently updated PHP from 5.2.10 to 5.3.3 and now I have problems when executing PHP scripts from command line, i receive an error "Call to undefined function pg_connect()" so it seems that cli does not recognize the php53-pgsql module
From the browser works fine but I need to execute scripts from command line
I have a Centos 5.5 and postgres 8.4

I checked the phpinfo of the php-cli and said it was php version 5.2.16 !! It seems that in the installation the 5.3 was installed ok on /usr/bin/php but /usr/local/bin/php had version 5.2 so I replaced it and now works fine!

Related

I'm getting the error on Cpanel that I'm running php 7.4 yet when I run php -v I get 8.02

I've deployed a laravel app on cpanel. The app is working as expected on my local machine but on cpanel I'm getting the error below.
Fatal error: Composer detected issues in your platform: Your Composer dependencies require a PHP version ">= 8.0.2". You are running 7.4.30. in /home4/peakcoke/public_html/vendor/composer/platform_check.php on line 24
When I run php -v I get 8.0.20.
How can I fix this?
Do a phpinfo(), what you get by running php -v from terminal is PHP CLI version.
Also, Cpanel usually comes with PHP Selector component that allows you to switch between different installed versions.

PHP intl not working when try to run from apache server

I have a mac book with php. 7.3 version. I have installed php intl and when i run the following command in terminal it is working fine.
php -r "locale_set_default('de-DE'); echo locale_get_default();"
But same code if i run in php file it`s giving error Call to undefined function CodeIgniter\locale_set_default(). Could you please some one help me.

Magento 2: Deprecated Functionality: Function ReflectionType::__toString() is deprecated

so I tried to execute the command 'php bin/magento setup:upgrade', but got the following error, even though everything worked fine in the morning:
Deprecated Functionality: Function ReflectionType::__toString() is deprecated in /usr/www/users/dlbbve/magento2/vendor/zendframework/zend-code/src/Reflection/ParameterReflection.php on line 85
After googling I found out that apparently the PHP v7.4 doesn't fully support M2 and I have to lower the PHP version to 7.3. I checked my php version in terminal and got
'PHP 7.4.2 (cli)'. So I looked up my servers PHP setting and it should be set to 7.3.
And when I used the 'phpinfo()' command in a php file I got the PHP version 7.3 something back.
My question is why are there different PHP versions? What can have caused it.
Best regards
With apache :
you should try to set php 7.3 version by running this command line :
$ sudo update-alternatives --set php /usr/bin/php7.3
and then
$ sudo service apache2 restart

Cannot fire php -v from terminal

I have uninstalled XAMPP because recently I found that php comes install by default in macOS. My MacOs version is Catalina. So whenever I fire any php command from cli it gives me Library not loaded but strange thing is it returns XAMP path.

Compiling PHP 5.1.6 from source - php -v and phpinfo() version discrepancy

I have just bought a VPS running Ubuntu and I need to install the LAMP stack with PHP 5.1.6. The VPS came with no PHP installed (checked this from the shell with php -v) and with Apache/2.2.12 installed. I installed PHP 5.1.6 from source and compiled it with Apache 2.2 (using libapache2-mod-php5), tried a phpinfo() test which worked fine, however, phpinfo() shows the PHP version as 5.2.1 (with JSON enabled), whereas running php-v in the shell shows as 5.1.6. Anyone any ideas what might be happening here? I need to ensure I am running PHP 5.1.6.
Thanks in advance for any help!
php -v gives you the version of the cli installation of php, while phpinfo will give you the version which got installed as apache module.
If you are not using cli php anywhere, you should be fine with running php scripts off apache.
But ideally you should fix this.

Categories