Error reporting
php.ini >> display_errors = On/Off
Script to check fsockopen
<?php
If(function_exists("fsockopen")){
echo 'Function Exists';
}
Else{
echo 'function does not exist';
}
?>
PHP extension installation without easy apache
----------------------------------------
cd /home/cpeasyapache/src/php-5.3.3/ext/pdo
phpize
./configure
make
make install
Then copy the extension to php.ini
echo extension=pdo.so >> /usr/local/lib/php.ini
Script to see loaded apache modules
<?php
print_r (apache_get_modules())
?>
Script to check curl is installed
//Put the following script in /usr/local/apachec/htdocs or under a domain//
<?php
echo '<pre>';
var_dump(curl_version());
echo '</pre>';
?>
Optimize PHP
html_errors = Off/On // Disable/Enable the inclusion of HTML tags in error messages
track_errors = Off/On // Store the last error/warning message in $php_errormsg
ignore_repeated_source = Off //Ignore source of message when ignoring repeated messages
log_errors = On/Off //Log errors into a log file (stderr, or error_log )
display_startup_errors = Off/On //errors that occur during PHP's startup. recommended to keep display_startup_errors off
error_log = file // Specify the file were error log created
register_globals = On/Off //Using form variables as globals can easily lead to possible security problems
post_max_size = 8M //Maximum size of POST data that PHP will accept
upload_max_filesize = 12M // Maximum allowed size for uploaded files
allow_url_fopen = Off/On // Whether to allow the treatment of URLs (like http:// or ftp://) as files
Check suphp enabled
vi /usr/local/apache/conf/php.conf == Check the suphp entries in the file (# SuPHP configuration for PHP5)
/usr/local/cpanel/bin/rebuild_phpconf --current
PHP upgrade manually in centos5 + Plesk
In order to upgrade PHP 5 on a Linux server to the latest version perform the following steps:
Applies to:
Plesk 8.x for Linux
Plesk 9.x for Linux
Download the installer script which updates Yum's repositories:
Quote:
[root@server ~]# wget http://78.129.170.254/cpinstall/atomic
--2009-11-12 15:40:22-- http://78.129.170.254/cpinstall/atomic
Connecting to 78.129.170.254:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 8918 (8.7K) [text/plain]
Saving to: `atomic'
100%[=====================================>] 8,918 35.7K/s in 0.2s
2009-11-12 15:40:22 (35.7 KB/s) - `atomic' saved [8918/8918]
Execute this downloaded script using the following command:
Quote:
[root@server ~]# sh atomic
Atomic Archive installer, version 1.1
Configuring the [atomic] yum archive for this system
Installing the Atomic GPG key: OK
Downloading atomic-release-1.0-10.el5.art.noarch.rpm: OK
Would you like to add the Plesk yum repository to the system?
Enable Plesk repository? (y/n) [Default: n]: y
Plesk 8.6 and 9.2 repositories are available:
NOTE: Plesk 9 repos are only available for rhel/centos 4 and 5
Enable Plesk 8.6 or 9.2? (8/9) [Default: 8]: 9
The Atomic Rocket Turtle archive has now been installed and configured for your system.
The following channels are available:
atomic - [ACTIVATED] - contains the stable tree of ART packages.
atomic-testing - [DISABLED] - contains the testing tree of ART packages.
atomic-bleeding - [DISABLED] - contains the development tree of ART packages.
Now run "yum upgrade php" to upgrade the PHP to the latest version:
Quote:
[root@server ~]# yum upgrade php
The PHP upgrade process will commence & will finish within the next 5 minutes.
Finally execute these 3 commands to restart the web services & to accept the new PHP:
Quote:
[root@server ~]# /etc/init.d/psa stopall
[root@server ~]# /etc/init.d/psa startall
[root@server ~]# /etc/init.d/psa restart
Now check the newer installed version of PHP using the php -v command..