Difference between revisions of "Php"
From Wasya Wiki
(→Libraries) |
(→Libraries) |
||
Line 50: | Line 50: | ||
= Libraries = | = Libraries = | ||
+ | |||
+ | == sqlite == | ||
+ | |||
+ | # /etc/apt/sources.list.d/sury-php.list | ||
+ | deb http://ftp.us.debian.org/debian sid main | ||
apt-get install php8.2-sqlite | apt-get install php8.2-sqlite |
Latest revision as of 23:42, 8 September 2024
Contents
Install
install composer
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" php -r "if (hash_file('sha384', 'composer-setup.php') === '55ce33d7678c5a611085589f1f3ddf8b3c52d662cd01d4ba75c0ee0459970c2200a51f492d557530c71c15d8dba01eae') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;" php composer-setup.php php -r "unlink('composer-setup.php');" sudo mv composer.phar /usr/local/bin/composer
then
sudo apt-get install php -y sudo apt-get install -y php-{bcmath,bz2,intl,gd,mbstring,mysql,zip} && sudo apt-get install libapache2-mod-php -y
install 7.4 on mac
From: https://getgrav.org/blog/macos-catalina-apache-multiple-php-versions
From: https://gist.github.com/dtomasi/ab76d14338db82ec24a1fc137caff75b
brew tap exolnet/homebrew-deprecated brew install php@7.4 LoadModule php7_module /usr/local/opt/php@7.3/lib/httpd/modules/libphp7.so
brew services start php@7.4 lsof -Pni4 | grep LISTEN | grep php
brew unlink php brew link php@7.4
install php 8 on ubuntu
With root access:
apt update && apt install -y wget gnupg2 lsb-release wget https://packages.sury.org/php/apt.gpg && apt-key add apt.gpg echo "deb https://packages.sury.org/php/ $(lsb_release -sc) main" | tee /etc/apt/sources.list.d/php.list apt update && apt install -y php8.1 php -v # Outputs "PHP 8.1.3 ..."
Develop
disable warnings
$config['system.logging']['error_level'] = 'some'; // hide|some|all|verbose error_reporting(E_ALL); ini_set('display_errors', TRUE); ini_set('display_startup_errors', TRUE);
Libraries
sqlite
# /etc/apt/sources.list.d/sury-php.list deb http://ftp.us.debian.org/debian sid main
apt-get install php8.2-sqlite apt-cache search php | grep sqlite
Composer
sudo apt install composer composer install
phpunit
Update:
wget https://phar.phpunit.de/phpunit.phar chmod +x phpunit.phar which phpunit sudo mv phpunit.phar /usr/local/bin/phpunit
Troubleshoot
Turn on logging
@ini_set( 'display_errors', getenv('display_errors') ); @ini_set( 'display_errors', 1 );
/var/www/html/wp-content/debug.log will have the file.