Ubuntu 管理心得

搜尋此網誌

顯示具有 php 標籤的文章。 顯示所有文章
顯示具有 php 標籤的文章。 顯示所有文章

2023年11月13日 星期一

phpmyadmin import file size too large

 edit /etc/php/8.1/fpm/php.int:

upload_max_filesize = 200M
post_max_size = 300M

sudo systemctl restart php8.1-fpm

Go to: http://localhost/~chiao/phpinfo.php to check if it is changed.

2023年5月3日 星期三

php display errors

 

ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);

2023年3月18日 星期六

Install phpmyadmin on pi raspbian bullseye

 cf: http://linux.how2shout.com/how-to-install-phpmyadmin-on-debian-11-bullseye-apache/

  1. sudo apt -y install php-cgi php-mysqli php-pear php-mbstring libapache2-mod-php php-common php-phpseclib php-mysql
  2. wget https://www.phpmyadmin.net/downloads/phpMyAdmin-latest-all-languages.tar.gz
  3. sudo tar xvf phpMyAdmin-latest-all-languages.tar.gz
  4. sudo mv phpMyAdmin-*-all-languages/ /var/www/html/phpmyadmin
  5. cd /var/www/html
    sudo cp phpmyadmin/config.sample.inc.php phpmyadmin/config.inc.php
  6. sudo mkdir /var/www/html/phpmyadmin/tmp
  7. openssl rand -base64 32
    (copy the output key)
  8. sudo vim /var/www/html/phpmyadmin/config.inc.php
  9. Put the key in Step 6 into:
    $cfg[‘blowfish_secret’] = ‘your-key‘; /* YOU MUST FILL IN THIS FOR COOKIE AUTH! */
  10. And add this line:
    $cfg['TempDir'] = '/var/www/html/phpmyadmin/tmp';
  11. sudo chown -R www-data:www-data /var/www/html/phpmyadmin
  12. sudo vim /etc/apache2/conf-available/phpmyadmin.conf
  13. Add the followings:
    Alias /phpmyadmin /var/www/html/phpmyadmin

    <Directory /var/www/html/phpmyadmin/>
       AddDefaultCharset UTF-8
       <IfModule mod_authz_core.c>
              <RequireAny>
          Require all granted
         </RequireAny>
       </IfModule>
    </Directory>

    <Directory /var/www/html/phpmyadmin/setup/>
       <IfModule mod_authz_core.c>
         <RequireAny>
           Require all granted
         </RequireAny>
       </IfModule>
    </Directory>
  14. sudo a2enconf phpmyadmin.conf
  15. sudo systemctl restart apache2

php stuff in pi4

  1. sudo apt purge php*
  2. sudo apt install php8.0
  3. sudo apt install php8.0-mysql
    sudo apt install php8.0-dom
    sudo apt install php8.0-mbstring
    sudo apt install php8.0-fpm
    sudo apt install php8.0-pear
    sudo apt install php-pear

2022年11月16日 星期三

PhpOffice\PhpSpreadsheet\Spreadsheet' not found

composer require phpoffice/phpspreadsheet



You have requested a non-existent service "user.private_tempstore"

Change this line:

$tempstore = \Drupal::service('user.private_tempstore')->get('appraisal_edit');

into

$tempstore = \Drupal::service('tempstore.private')->get('appraisal_edit');



2022年5月4日 星期三

ubuntu 22.04 need php fpm

 Otherwise, the html lines inside php file would have error.

sudo apt install php8.1-fpm
sudo a2enconf php8.1-fpm
sudo systemctl reload apache2

2022年2月6日 星期日

install pear php-pear spreadsheet

  1. sudo apt install php-pear
  2. Goto https://pear.php.net/package/OLE to see what OLE version is now. Say, 1.0.0RC3 (beta) was released on 2017-06-20
  3. sudo pear install OLE-1.0.0RC3
  4. Goto https://pear.php.net/package/Spreadsheet_Excel_Writer to see what SpreadSheet version is now. Say, 0.9.4 (beta) was released on 2017-05-24
  5. sudo pear install Spreadsheet_Excel_Writer-0.9.4
  6. Done

2021年12月4日 星期六

Warning: "continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"?

cf: https://stackoverflow.com/questions/54184707/warning-continue-targeting-switch-is-equivalent-to-break-did-you-mean-to-u

 

 Error while exporting excel from FAHP online system:

Warning: "continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"? in /usr/share/php/OLE.php on line 319

sudo vim +319 /usr/share/php/OLE.php

Change "continue" to "continue 2" as follows:

  default:
#chiao, 2021-12-5               
#                continue;
                continue 2;

2021年11月28日 星期日

phpmyadmin using zip to export database

  1. Edit php.ini, set zlib.output_compression = On
  2. sudo apt install php7.4-zip

2021年11月25日 星期四

Unexpected 'new' (T_NEW) in /usr/share/php/Spreadsheet/Excel/Writer/Workbook.php

cf: https://stackoverflow.com/questions/45057005/when-i-am-trying-to-export-excel-file-in-php-7-same-code-is-working-in-php5

Because Error msg:
Parse error: syntax error, unexpected 'new' (T_NEW) in /usr/share/php/Spreadsheet/Excel/Writer/Workbook.php on line 180

Edit the line 180 as:

#        $this->_parser           =& new Spreadsheet_Excel_Writer_Parser($this->_byte_order, $this->_BIFF_version);
        $this->_parser           =new Spreadsheet_Excel_Writer_Parser($this->_byte_order, $this->_BIFF_version);

And line 194 as:

#        $this->_tmp_format       =& new Spreadsheet_Excel_Writer_Format($this->_BIFF_version);
        $this->_tmp_format       =new Spreadsheet_Excel_Writer_Format($this->_BIFF_version);
 

網誌存檔