Wednesday 11 September 2019

PHP remove installed php, tricks including php.ini, conf.d, php-fpm

// PHP find location of php.ini file

php -i | grep php.ini

https://www.howtogeek.com/50853/find-the-php-ini-file-location-from-the-command-line/

// PHP SYSTEM installed Modules located

/etc/php/PHP_VERSION/mods-available

// PHP init file located
/etc/php/PHP_VERSION/cli/php.ini

// PHP dynmic extension loader
/etc/php/PHP_VERSION/cli/conf.d

// PHP user installed module located in 
/usr/lib/php/20170718 (folder for php7.2)


// Use of /etc/php7.x/cli/conf.d ?
Those files will overwrite the settings in php.ini. Putting config stuff here allows you to have custom settings while keeping updates simpler: if you modify php.ini itself then you either have to retain the old php.ini or overwrite it when you update PHP. If you keep your custom settings in, eg. conf.d/local.ini then you can update PHP easily while retaining any environment-specific settings

// in conf.d
each xxx.ini file changes the php.ini file, its just a centralized place to manage

// for example vim 20-xxx.ini  , extension=sqlsrv.so

https://stackoverflow.com/questions/13383806/what-the-ini-files-in-etc-php5-conf-d-folder-are-for

// Find duplicate file
fdupes
https://www.howtogeek.com/201140/how-to-find-and-remove-duplicate-files-on-linux/

// phpsize not found?
sudo apt-get install php7.x-dev
https://stackoverflow.com/questions/3108937/how-to-install-and-run-phpize

// PHP extension installed in another directory?
Probably have two php installed
check whereis php command to see if there are two php dir specified, and one is infront of other
need to uninstall a php version

apt purge php 7.x php 7.x-common
https://ayesh.me/Ubuntu-PHP-7.3

// PHP FPM status
ps aux | grep php-fpm
service php7.x-fpm status
https://stackoverflow.com/questions/14915147/php-fpm-check-if-running


// PHP version
php -v



which php - will locate the php executable (this should be the default php used by you)
whereis php - The first path displayed will be the location of the php executable
echo $PATH - will print a list of paths separated by ":" where the system looks for commands

// PHP sytem mods located

/etc/php/PHP_VERSION/mods-available
https://tecadmin.net/enable-disable-php-modules-ubuntu/

// PHP user installed mods located
/usr/lib/php/20170718 - for php7.2
https://github.com/microsoft/msphpsql/issues/736


// sqlsrv already loaded error (PHP Warning: Module 'XXX' already loaded in Unknown on line 0)

Check /etc/php7.x/cli/conf.d to see if there are duplicate files, if not, check ini files to see if there are duplicate lines in each ini file.

execute

echo extension=pdo_sqlsrv.so >> `php --ini | grep "Scan for additional .ini files" | sed -e "s|.*:\s*||"`/20-pdo_sqlsrv.ini (Correction pdo_sqlsrv.ini must run before sqlsrv.ini)
echo extension=sqlsrv.so >> `php --ini | grep "Scan for additional .ini files" | sed -e "s|.*:\s*||"`/30-sqlsrv.ini

multiple times will result
extension =pdo_sqlsrv.so
extension =pdo_sqlsrv.so
extension =pdo_sqlsrv.so

be created multiple times in 20-pdo_sqlsrv.ini
https://github.com/Homebrew/homebrew-php/issues/3896


No comments:

Post a Comment