PHP Error Fixes

Your PHP installation appears to be missing the MySQL extension which is required by WordPress.

To install php5-mysql module enter:

sudo apt-get install php5-mysql

Next, restart the Apache2/Nginx web server:
sudo service apache2 restart / sudo service nginx restart

To verify if this worked correctly, create a new PHP file some where on your web server and place this inside of it:

<?php phpinfo(); ?>

 

Digital Ocean

syntax error, unexpected 'use' then how to use

use statements should appear at the top of a PHP file, not half-way through it...


 

Got error 28 from storage engine

check your server storage.. df -h


 

Call to undefined method CI_DB_mysqli_result::next_result()

open system/database/drivers/mysqli/mysqli_driver.php then change the function _execute() to the code below

function _execute($sql) {
// Free result from previous query
@mysqli_free_result($this->result_id);

$sql = $this->_prep_query($sql);

// get a result code of query (), can be used for test is the query ok
$retval = @mysqli_multi_query($this->conn_id, $sql);

// get a first resultset
$firstResult = @mysqli_store_result($this->conn_id);

// free other resultsets
while (@mysqli_next_result($this->conn_id)) {
$result = @mysqli_store_result($this->conn_id);
@mysqli_free_result($result);
}

// test is the error occur or not 
if (!$firstResult && !@mysqli_errno($this->conn_id)) {
return true;
}
return $firstResult;
}

Call to undefined function curl_init()

;extension=php_curl.dll
or
sudo apt-get install php5-curl

nginx - upstream timed out

Add this

fastcgi_read_timeout 150;

With your php-fpm configuration it should look like this:

location ~* .php$ {
include fastcgi_params;
fastcgi_index index.php;
fastcgi_read_timeout 150;
fastcgi_pass 127.0.0.1:9000;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}

Phpbrew - Ubuntu - GD Library extension not available with this PHP installation.

phpbrew ext install gd --with-gd=shared,/usr --enable-gd-native-ttf --with-gmp=shared,/usr --with-jpeg-dir=shared,/usr --with-xpm-dir=shared,/usr/X11R6 --with-png-dir=shared,/usr --with-freetype-dir=shared,/usr --with-vpx-dir=shared,/usr
phpbrew fpm restart

Phpbrew - ubuntu - composer php is reading the wrong version

Turns out that we need to install the composer for phpbrew, it will update the default composer on the system.

phpbrew app get composer

HTMLDomParser file_get_html stream does not support seeking

Now that I start using higher than PHP7++, shows error on file_get_html, this is because there's an update on PHP7++

From

$html = HTMLDomParser::file_get_html($this->url.$i);

To

$html = HTMLDomParser::file_get_html($this->url.$i , '', null , 0);

Failed to start php7.2-fpm.service: Unit php7.2-fpm.service is masked.

  1. sudo apt install php7.2-fpm
  2. sudo service php7.2-fpm restart

Subscribe to You Live What You Learn

Don’t miss out on the latest issues. Sign up now to get access to the library of members-only issues.
[email protected]
Subscribe