PHP: Difference between revisions

From Cheatsheet
Jump to navigation Jump to search
Line 9: Line 9:
One liner PHP info, make sure to change (username here) ti the account in questions username.
One liner PHP info, make sure to change (username here) ti the account in questions username.
  touch phpinfo.php && chown (username here). phpinfo.php && echo "<?php phpinfo(); ?>" > phpinfo.php
  touch phpinfo.php && chown (username here). phpinfo.php && echo "<?php phpinfo(); ?>" > phpinfo.php
A real one liner, that requires no edits copy pasta go!
for i in `pwd | cut -d/ -f3`; do touch /home/$i/public_html/phpinfo.php && chown $i. /home/$i/public_html/phpinfo.php && echo "<?php phpinfo(); ?>" > /home/$i/public_html/phpinfo.php; done


== PHP version's ==
== PHP version's ==

Revision as of 17:34, 27 January 2012

PHP FOO, Enjoy ;P


PHP info

Make a file called phpinfo.php under the account that you wish to test. Place the below in as the contents.

<?php phpinfo(); ?>

One liner PHP info, make sure to change (username here) ti the account in questions username.

touch phpinfo.php && chown (username here). phpinfo.php && echo "<?php phpinfo(); ?>" > phpinfo.php

A real one liner, that requires no edits copy pasta go!

for i in `pwd | cut -d/ -f3`; do touch /home/$i/public_html/phpinfo.php && chown $i. /home/$i/public_html/phpinfo.php && echo "<?php phpinfo(); ?>" > /home/$i/public_html/phpinfo.php; done

PHP version's

To test the current handler as well as the versions of php.

/usr/local/cpanel/bin/rebuild_phpconf --current

If EasyApache has never been ran you will need to fo a manual query to figure the relavent information out.

cat /usr/local/apache/conf/httpd.conf | grep  LoadModule | grep php

Setting the default PHP version in the .htaccess

vim /usr/local/apache/conf/php.conf

go to the following and you want to copy out the line starting with "AddType" will look something like this but might be different...

AddType application/x-httpd-php5 .php5 .php4 .php .php3 .php2 .phtml

copy the whole line and if you are doing php4 change the 5 to 4's and vice versa, but dont have any duplicate options.

Random PHP stuffs

PHP 4 module check

/usr/local/php4/bin/php

enable/disable monitoring script ---

wget http://scripts.ssullivan.org/apiCalls/confMonitoring
perl confMonitoring

PhP mem limit on a shared with dso goes into the public_html in the .htaccess

php_value memory_limit 64M

To veiw availiable php extensions

/scripts/phpextensionmgr list

To install php extensions

/scripts/phpextensionmgr install (name here)

PHP rpm's for coremanaged moxes. php rpms

PHPmyadmin

To update just phpmyadmin.

/usr/local/cpanel/bin/updatephpmyadmin --force