Christopher Juckins

SysAdmin Tips, Tricks and other Software Tools

User Tools

Site Tools


php_tricks

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Last revisionBoth sides next revision
php_tricks [2016/07/20 16:56] juckinsphp_tricks [2018/10/19 14:12] juckins
Line 1: Line 1:
 +__Installing PHP 7 on CentOS7__
 +  * Follow [[https://www.tecmint.com/install-php-7-in-centos-7/|TecMint instructions]]
 +  * yum install php-mbstring
 +
 +Code tips:
 +
 +<code>
 $actual_link = 'http://'.$_SERVER['HTTP_HOST'].$_SERVER['PHP_SELF']; $actual_link = 'http://'.$_SERVER['HTTP_HOST'].$_SERVER['PHP_SELF'];
 echo "Our URL: $actual_link<br><br>\n"; echo "Our URL: $actual_link<br><br>\n";
  
- # the entire URL of the current page, including query string+# the entire URL of the current page, including query string
 $url = $_SERVER['REQUEST_URI']; $url = $_SERVER['REQUEST_URI'];
 echo "\$_SERVER['REQUEST_URI'] ---> $url<br><br>\n"; echo "\$_SERVER['REQUEST_URI'] ---> $url<br><br>\n";
Line 17: Line 24:
 $path = substr($_SERVER['REQUEST_URI'], 0, strrpos($_SERVER['REQUEST_URI'], '/') + 1); $path = substr($_SERVER['REQUEST_URI'], 0, strrpos($_SERVER['REQUEST_URI'], '/') + 1);
 echo "Path of the URL without the filename ---> $path<br>\n"; echo "Path of the URL without the filename ---> $path<br>\n";
 +</code>
  
 More info on parsing the URL: http://php.net/manual/en/function.parse-url.php  More info on parsing the URL: http://php.net/manual/en/function.parse-url.php 
  
 +Showing errors:
 +<code>
 +<?php
 +ini_set('display_errors', 1);
 +ini_set('display_startup_errors', 1);
 +error_reporting(E_ALL);
 +?>
 +
 +test
 +
 +<?php
 +echo "test<br>\n";
 +$file=fopen("welcome.txt","r");
 +?>
 +</code>
php_tricks.txt · Last modified: 2018/11/01 21:32 by juckins