Running PHP in ubuntu terminal not working anymore - php

I was trying a PHP script in the terminal yesterday but it didn't work. Not thinking the script could have errors i reinstalled php7.0-cli and when installing it asked something about how i want to do something, i can´t remember what it asked for exactly. Anyhow i pressed the use local something option and after that i´m not finding my mysqli when trying to run the PHP file in terminal.
I´m getting a error like this:
Fatal error: Uncaught Error: Class 'mysqli' not found in /var/www/mysite/system/library/db/mysqli.php:7
I have tried reinstalling the PHP extensions and i have tried to uncomment the extensions from my php.ini file.

Related

OCI8 not active after installing imap extention (Oracle Linux)

I had a perfectly running local test environment with:
Oracle Linux 7 using httpd
PHP 7.4
Oracle DB 18c XE
several vhosts
Then I had to install the IMAP extention, and got this final message.
My local pages don't work anymore, and a look at the error log confirm my suspicion that it's because something happened to the OCI8:
PHP Fatal error: Uncaught Error: Call to undefined function oci_new_connect() in /var/www/
Finally, phpinfo() shows that there is indeed no OCI8.
Has anyone a way to solve this without much fuss? I checked and the correct OVI-8 version is still on my machine.

Connect to postgreSQL db using PHP on mac os X

I tried to connect to a local postgre Database with PDO using PHP.
When running my code, the error message showed: Fatal error: Uncaught PDOException: could not find driver in {file path}
After googling, it looks like updating the PDO extension is a way fixing it.
Then I tried to use the code here.
When executing line 21 ./configure --with-pdo-pgsql="/Library/PostgreSQL/9.3/"
, the error message is shown:
configure: error: Cannot find libpq-fe.h. Please specify correct PostgreSQL installation path
p.s. I check the setting of my Postgres, the paths are shown below, do I need to change path to one of those?
Then I googled for the error again. There are a number of post indicate that using yum -y install postgresql-devel
But the error shows again when I tried to run the code: -bash: yum: command not found
This is a confusing journey of PHP beginner tried to figure out getting data from a database using
PHP. Can someone provide a way to do achieve this (On Mac) ?
The problem is solved when changing my local server from xampp to mapp.

Cant load MongoDb driver in php.ini using Apache in Xampp

I am trying to learn PHP with mongodb backend, but I could not connect PHP to mongo because of the following error:
fatal error Mongo class undefined
I am using Xampp and netbeans as IDE. I looked it up and got that the drivers are to be installed.
So I downloaded the drivers which is php_mongo-1.4.x-5.5-vc11.dll. I put it in the .../php/ext/folder and edit php.ini placing extention = php_mongo.....dll.
But still when I start my apache it says php_mongo...dll not found althought it is placed correctly. Also it says libsasl.dll not found, which when I looked up, it was in place.
I have mongodb installed and I have correct driver version, so why does it happen?

ImageMagick on MAMP

I am trying to install ImageMagick on my Mac using MAMP using homebrew.
In the terminal I am not getting the following message:
Warning: php53-imagick-3.1.0RC2 already installed
When trying to run the install script, which was apparently successful, however I still receive the following error when trying to use ImageMagick from PHP:
Fatal error: Class 'Imagick' not found in....
I'm amazed at how difficult this has been, if anyone could help me out it would be greatly appreciated.

MAMP php includes

I'm not a php developer but I'm fiddling with MAMP. I've installed MAMP and my php include() calls aren't working.
[13-Jul-2010 19:23:30] PHP Fatal error: require_once() [<a href='function.require'>function.require</a>]: Failed opening required '1' (include_path='.:/Applications/MAMP/bin/php5.3/lib/php:/Applications/MAMP/htdocs/mt_sandbox/php/') in /Applications/MAMP/htdocs/mt_sandbox/php/email/owner_emails.php on line 5
As you can see there, I was trying to edit my php.ini file to use a second include path to the 'php' directory of my project 'mt_sandbox'.
Here are the exact includes
require_once("Mail.php") or die ('php load error for Mail.php');
require_once('/Applications/MAMP/htdocs/mt_sandbox/php/email/email_manager.php') or die ('php load error for email/email_manager.php');
The die messages aren't firing because I'm getting the PHP Fatal error.
Can anyone tell me what I'm doing wrong? How can I get setup to use includes in my scripts?
I ran across this same issue after upgrading to Mountain Lion. Considering how old your post is I assume you have solved this, but figure an answer may be useful for others searching.
When installing pear extensions for MAMP make sure to run your commands using the pear package in MAMP. If pear is already installed outside of MAMP and you execute
pear install -a Mail
This will fire off the wrong pear function. Executing this will tell you which pear function you are using.
which pear
For me it was in /opt/local/bin/pear
To use the MAMP pear function I navigated into this directory '/Applications/MAMP/bin/php/php5.4.4/bin' and used this command
./pear install -a Mail
This fired the pear command in MAMP and installed the package for me.
Use an absolute path to the file you're including

Categories