SQL Error since upgrading to MAMP v 3.5 - sql

I have a script that I run to create a Wordpress website. All runs well until I get to the:
wp core install --title=$client --url=$client.local --admin_user=$clientshort-admin --admin_password=******** --admin_email=********#gmail.com
I get the following:
Warning: mysqli_real_connect(): (HY000/2002): No such file or directory in /Applications/MAMP/htdocs/pndesign2/web/wp/wp-includes/wp-db.php on line 1488
Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in /Applications/MAMP/htdocs/pndesign2/web/wp/wp-includes/wp-db.php on line 1518
Warning: mysql_connect(): No such file or directory in /Applications/MAMP/htdocs/pndesign2/web/wp/wp-includes/wp-db.php on line 1518
Error: Error establishing a database connection
THanks!

After going round in circles, it was down to the PHP version differences between OSX/MAMP/ and WP-CLI.
Updating your .bash_profile with the version of MAMP solves it - more details here How to override the path of PHP to use the MAMP path?

Related

Problems with php-gd in php8.1

I have php8.1 running on FreeBSD 12.
Install php81-gd and having a trouble to start php due to the following error:
Any guess how to fix it, please?
PHP Warning: PHP Startup: Unable to load dynamic library 'gd.so' (tried: /usr/local/lib/php/20210902/gd.so (/usr/local/lib/php/20210902/gd.so: Undefined symbol "gdImageCreateFromAvif"), /usr/local/lib/php/20210902/gd.so.so (Cannot open "/usr/local/lib/php/20210902/gd.so.so")) in Unknown on line 0```
You probably need to upgrade the libgd package as well with pkg upgrade libgd; for whatever reason the package manager doesn’t seem to do it automatically when you install the php81-gd package.

how to install Imagic in WAMP server?

I am getting error php_imagick.dll is not working. %1 is not a valid W32 application.
I am using WAMP Server Apaches 2.4.4.6 and PHP 7.4.9. my OS is windows 10 64bit. i think i download php_imagick-3.6.0rc2-7.3-nts-vc15-x64.zip file.
I have installed all DDL file in PHP7.4.9/ext/ and apply all process for install Imagic but still i am getting error
i have add extension in php.ini file.
enter image description here
Warning: PHP Startup: Unable to load dynamic library 'php_imagick' (tried: d:/wamp/bin/php/php7.4.9/ext/php_imagick (%1 is not a valid Win32 application.), d:/wamp/bin/php/php7.4.9/ext/php_php_imagick.dll (The specified module could not be found.)) in Unknown on line 0
i tried to find required file and package form
https://windows.php.net/downloads/pecl/releases/imagick/3.6.0rc2/ also checked
https://www.apachelounge.com/viewtopic.php?t=6359
but nothing helpful for me. that Module is not loading..
please help me....
check that the dll is not blocked:
try downloading the imagick threadsafe for here, version made for your PHP version
also install it from here on top of it all

bWAPP- SQL injection Hack displays a white screen?

I've been following this video(https://www.youtube.com/watch?v=XDCZ8FC856s) to install bWAPP on Parrot OS and everything works fine except SQL Injection. I've checked the database and its active. As you can see:
And when I select SQL Injection(GET/Search) it just displays a blank white screen.
I've checked for answers in a couple of places but haven't found a robust answer. Any help would be awesome thanks.
Browser: Firefox Quantum 60.0.1(64-bit)
OS: Parrot( I also tried the same on Kali)
PHP Fatal error: Uncaught Error: Call to undefined function mysql_connect()
It looks like your code uses the mysql extension, and that extension is not present.
In other words, the error has nothing to do with SQL injection. The code for this app can't run given the PHP installation you have installed.
Run the command php --version, you'll see something like this:
$ php --version
PHP 7.1.16 (cli) (built: Mar 31 2018 02:59:59) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.1.0, Copyright (c) 1998-2018 Zend Technologies
You probably you have PHP 7.0 or later, in which the mysql extension is no longer available. If that's the version of PHP you have, then you will have to change the code of your application, so that it uses either mysqli or PDO.
See these answers from 2016:
PHP : Undefined function mysql_connect()
Fatal error: Uncaught Error: Call to undefined function mysql_connect()
Editing code from the outdates mysql extension to the mysqli extension is pretty easy.
https://www.phpclasses.org/blog/package/9199/post/3-Smoothly-Migrate-your-PHP-Code-using-the-Old-MySQL-extension-to-MySQLi.html
https://dzone.com/articles/convert-mysql-to-mysqli
There are many videos on YouTube about updating mysql code to mysqli. I haven't watched any of them so I can't recommend any specific video.
The other possibility is that you have PHP 5.6, but the installation is incomplete. You may be able to install an optional package to add the mysql extension to a PHP 5 installation. See this answer:
Fatal error: Call to undefined function mysql_connect()

PHP Fatal error: Class 'jsonserializable' not found in Unknown on line 0

Ubuntu 16.04
PHP 7.0.4
Phalcon 2.1.x
Zephir
$~: php -v
PHP Fatal error: Class 'jsonserializable' not found in Unknown on line 0
When add phalcon.so in php.ini
Somehow I found the answer on and old bug report here:
Segmentation fault after update to 2.1.x
The problem is that the phalcon extension is being loaded before the json extension, so I guess that you, as myself, added the extension=phalcon.so line in the main php.ini
What you have to do is add a file in /etc/php/7.0/mods-available called phalcon.ini with the line in it: extension=phalcon.so
Then you just go and make a softlink that points from /etc/php/7.0/cli/conf.d/50-phalcon.ini to that phalcon.ini file, (important to put a number higher than 20 so it gets loaded after the json extension) and that's it!
Repeat the process to any other configuration that you have for php (apache, nginx, etc).

How to deploy fuelphp website to server

I'm new to fuelPHP, I developed a simple application and when I uploaded the files to my web server I got those errors :
Notice: Use of undefined constant __DIR__ - assumed '__DIR__' in /home1/tdfdf/public_html/site/site/public/index.php on line 22
Fatal error: require() [function.require]: Failed opening required '/bootstrap.php' (include_path='.:/usr/lib64/php:/usr/lib/php:/usr/share/pear') in /home1/tdfdf/public_html/site/site/public/index.php on line 44
I probably miss some configurations here. I also want to remove this "/public" from the url
Can any one help ?
I found the solution. The DIR is not defined for older versions of PHP . I changed my server settings to run on PHP 5.3 and it worked like magic.
Thanks.