Warning: this is an htmlized version!
The original is here, and
the conversion rules are here.
#######
#
# E-scripts on PHP3, PHP4 and friends.
#
# Note 1: use the eev command (defined in eev.el) and the
# ee alias (in my .zshrc) to execute parts of this file.
# Executing this file as a whole makes no sense.
# An introduction to eev can be found here:
#
#   (find-eev-quick-intro)
#   http://angg.twu.net/eev-intros/find-eev-quick-intro.html
#
# Note 2: be VERY careful and make sure you understand what
# you're doing.
#
# Note 3: If you use a shell other than zsh things like |&
# and the for loops may not work.
#
# Note 4: I always run as root.
#
# Note 5: some parts are too old and don't work anymore. Some
# never worked.
#
# Note 6: the definitions for the find-xxxfile commands are on my
# .emacs.
#
# Note 7: if you see a strange command check my .zshrc -- it may
# be defined there as a function or an alias.
#
# Note 8: the sections without dates are always older than the
# sections with dates.
#
# This file is at <http://angg.twu.net/e/php.e>
#           or at <http://angg.twu.net/e/php.e.html>.
#        See also <http://angg.twu.net/emacs.html>,
#                 <http://angg.twu.net/.emacs[.html]>,
#                 <http://angg.twu.net/.zshrc[.html]>,
#                 <http://angg.twu.net/escripts.html>,
#             and <http://angg.twu.net/>.
#
#######





# «.debian»			(to "debian")
# «.functions»			(to "functions")
# «.webshell»			(to "webshell")
# «.webshell-old»		(to "webshell-old")
# «.phpnuke»			(to "phpnuke")
# «.php5-on-etch»		(to "php5-on-etch")
# «.php5-lenny»			(to "php5-lenny")
# «.php-5.6-on-wheezy»		(to "php-5.6-on-wheezy")
# «.php-5.5-on-wheezy»		(to "php-5.5-on-wheezy")
# «.php-doc»			(to "php-doc")
# «.php5-cli»			(to "php5-cli")
# «.require-and-include»	(to "require-and-include")
# «.include_path»		(to "include_path")
# «.facebook-sdk»		(to "facebook-sdk")
# «.autoload»			(to "autoload")
# «.errors»			(to "errors")
# «.boris»			(to "boris")
# «.naofo.de»			(to "naofo.de")

# «.php-raphael-0»		(to "php-raphael-0")
# «.php-raphael»		(to "php-raphael")
# «.http-header»		(to "http-header")
# «.php-http»			(to "php-http")


# (find-phpdocpage "tutorial")
# (find-phpfuncpage "phpinfo")
# (find-phpfuncpage "require")




mkdir ~/public_html/
(setq ee-file-php "~/public_html/ee-tmp.php4")
(setq ee-url-php  "http://127.0.0.1/~edrx/ee-tmp.php4")

# oops - php disabled?



#####
#
# debian
# 2022nov01
#
#####

# «debian»  (to ".debian")
# (find-zsh "availabledebs | sort | grep php")
# (find-status   "php")
# (find-vldifile "php.list")
# (find-udfile   "php/")
# (find-status   "php7.4")
# (find-vldifile "php7.4.list")
# (find-udfile   "php7.4/")
# (find-status   "php7.4-common")
# (find-vldifile "php7.4-common.list")
# (find-udfile   "php7.4-common/")
# (find-status   "php-cli")
# (find-vldifile "php-cli.list")
# (find-udfile   "php-cli/")
# (find-status   "php7.4-cli")
# (find-vldifile "php7.4-cli.list")
# (find-udfile   "php7.4-cli/")

* (eepitch-shell)
* (eepitch-kill)
* (eepitch-shell)
apti php
apti php-cli
# (find-man "php-cli")
# (find-man "php")
# (find-man "php.default")

php-cli: /usr/share/man/man1/php.default.1.gz

https://www.php.net/manual/en/
https://www.php.net/manual/en/intro-whatcando.php




#####
#
# functions
# 2022nov01
#
#####

# «functions»  (to ".functions")
# https://www.php.net/manual/en/function.include.php
# https://www.php.net/language.functions

* (eepitch-php)
* (eepitch-kill)
* (eepitch-php)
function square($a) { return $a*$a; }
echo square(2);




#####
#
# ?
# 2004sep24
#
#####

#*
# (ee-once (eeb-php))
echo getcwd(), "\n";
#*
# (ee-once (eeb-php))
echo system("set"), "\n";
#*
# (ee-once (eeb-php))
echo $_SERVER['REMOTE_ADDR'], "\n";
#*
# (ee-once (eeb-php))
$ip = $_SERVER['REMOTE_ADDR'];
$goodip = "127.0.0.1";
if ($ip != $goodip) {
  echo "$ip != $goodip\n";
  exit;
}
echo "ok\n";
#*
# (ee-once (eeb-php+))
# (find-phpdocpage "index")
phpinfo();

#*
# (ee-once (eeb-php))
# (find-phplangw3m "types.array.html")
# (find-phpdocw3m "control-structures.foreach.html")
# (find-phplangpage "types.array")
$arr = array("foo" => "bar", 12 => true);
echo $arr["foo"], "\n"; // bar
echo $arr[12], "\n";    // 1

#*





# (find-phpdocpage "index")
# (find-phplangpage "variables.external")
# (find-phpfuncpage "import-request-variables")






#####
#
# webshell
# 2004sep24
#
#####

# «webshell»  (to ".webshell")
#*
sudo touch     /var/www/tmp.php
sudo chmod 666 /var/www/tmp.php

#*
cat > /var/www/tmp.php <<'%%%'
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 3.2//EN">
<html>
<head>
<title></title>
</head>
<body>

<?
  $ip = $_SERVER['REMOTE_ADDR'];
  $goodip = "127.0.0.1";
  if ($ip != $goodip) {
    echo "$ip != $goodip\n";
    exit;
  } else {
    $pwd = $_REQUEST['pwd'];
    if (!$pwd) { $pwd = getcwd(); }
    $command = $_REQUEST['command'];
    if ($command) { $result = `cd $pwd\n$command`; }
    ?>

<form action="<? echo basename($_SERVER['SCRIPT_NAME']) ?>" method=get>
at: <input type=text name=pwd value="<? echo $pwd ?>" size=56><br>
do:
<textarea name='command' cols=60 rows=4><? echo $command ?>
</textarea>
<br>
<input type=submit name=do value="Go!">
</form>
<pre>
<? echo $result ?>
</pre>

    <?
  }
?>

</body></html>
%%%

lynx http://127.0.0.1/tmp.php

#*
sudo rm /var/www/tmp.php

#*





#####
#
# To run shell commands in machines that allow only php
# 2000aug02
#
#####

# «webshell-old»  (to ".webshell-old")
# (find-fline "~/PHP3/tarstuff.php3")
#*
cat > /var/www/tmp.php3 <<'---'
<? include ("/home/root/PHP3/functions.php3");
  // error_reporting(1+12+48);
  function v($s) { return htmlspecialchars($s); }
  function p($s) { return htmlspecialchars($s); }
  if (!$pwd)
    $pwd = posix_getcwd();
  echo "<head></head>
    <body>
    <form action=\"http://$HTTP_HOST$SCRIPT_NAME\" method=post>
    cd <input type=text size=60 name=pwd value=\"".v($pwd)."\"><br>
    <input type=text size=63 name=cmd value=\"".v($cmd)."\"><br>
    <input type=submit></form>
    <pre>\n";
  if (!@chdir($pwd)) {
    echo "no such dir: $pwd\n";
  } else {
    if ($cmd) {
      $s = "# $pwd\n# $cmd\n\n";
      $arr = array();
      $cmd = "export EE=" . dirname($SCRIPT_FILENAME) . "/ee.sh; " .
	     "alias ee='. $EE'; " .
             "($cmd) 2>&1";
      exec($cmd, $arr, $exitcode);
      $s .= join("\n", $arr) . "\n";
      if ($exitcode)
        $s .= "\n# exitcode = $exitcode\n";
      echo p($s);
    }
  }
  echo "</pre></body>\n";
?>
---
wget -q -O - 'http://127.0.0.1/tmp.php3'
wget -q -O - 'http://127.0.0.1/tmp.php3?pwd=/home'
wget -q -O - 'http://127.0.0.1/tmp.php3?pwd=/home&cmd=echo+hello'
wget -q -O - 'http://127.0.0.1/tmp.php3?pwd=/home&cmd=ls;false'
wget -q -O - 'http://127.0.0.1/tmp.php3?pwd=/naaa'
lynx http://127.0.0.1/tmp.php3

#*


# (find-php3fun "exec")
# (find-php3fun "chdir")
# (find-php3fun "posix-getcwd")

  phpinfo();

lynx /tmp/o.html

# (find-php3hw3 "language.variables.external.html")
# (find-php3hw3 "configuration.html")

# (find-angg ".zshrc" "runtmpcgi")

# (find-php3fun "require")
# (find-php3fun "include")





Pgrepp m/php/i |& l






#####
#
# php3-doc
# 2000jun25
#
#####

# (find-status "php3-doc")
# (find-vldifile "php3-doc.list")
# (find-fline "/usr/doc/php3-doc/")

# (find-fline "/usr/doc/php3-doc/html/")
# (find-fline "/usr/doc/php3-doc/")
# (find-fline "/usr/share/doc-base/php3-doc")

# (find-udw3 "php3-doc/html/manual.html")
lynx         /usr/doc/php3-doc/html/manual.html
edrxnetscape /usr/doc/php3-doc/html/manual.html &

# (find-udw3 "php3-doc/html/")
# (find-node "(libc)Pipe to a Subprocess")

# Make a single file with the bodies of all docs of PHP functions:

#*
rm -Rv /tmp/phpfunctions/
mkdir  /tmp/phpfunctions/
cd /usr/doc/php3-doc/html/
for i in function.*.html; do
  cp -v $i /tmp/phpfunctions/$(echo $i | sed 's/function.\(.*.html\)/\1/')
done
#*
cd /tmp/phpfunctions/
for i in *; do
  echo "«$(basename $i .html)»"
  lynx -dump $i \
    | expect -c '
	set s [read stdin]
	regsub -all "_____+" $s "*" s
	regexp "*\n *\n *(.*\n) +*" $s -> s
	puts "$s\n"
      '
done | tee ~/tmp/ophpfunctions
#*

# (find-fline "~/tmp/ophpfunctions")





#####
#
# php3
# 2000jun25
#
#####

# (find-status "php3")
# (find-vldifile "php3.list")
# (find-fline "/usr/doc/php3/")

# (find-vldifile "php3.postinst")
# (find-vldifile "php3.postinst" "/etc/apache/httpd.conf")
# (find-vldifile "php3.prerm")

# (find-fline "/usr/doc/php3/extra/cyberlib/")
# (find-fline "/usr/doc/php3/examples/")
# (find-fline "/usr/doc/php3/examples/album/")

# (find-udw3 "php3-doc/html/configuration.html")
# (find-fline "/etc/php3/apache/php3.ini")

# (find-fline "/etc/apache/")
# (find-fline "/etc/apache/httpd.conf")
# (find-fline "/etc/apache/httpd.conf" "php3_module")

# (find-fline "/usr/sbin/apacheconfig")
# (find-fline "/usr/sbin/apacheconfig" "sub find_suitable_modules")
# (find-fline "/usr/sbin/apacheconfig" "Waiting for apache to terminate ...")

/usr/sbin/apachectl stop
sleep 10
/usr/sbin/apachectl start
/etc/init.d/apache reload-modules




#####
#
# php3-dev
# 2000jul04
#
#####

# (find-status "php3-dev")
# (find-vldifile "php3-dev.list")
# (find-fline "/usr/doc/php3-dev/")



#####
#
# First php3 tests
# 2000jun28
#
#####

#*
cat > /var/www/test.php3 <<'----'
<html>
<head>
<title>Example</title>
</head>
<body>
  <?php echo "Hi, I'm a PHP script!"; ?>
</body>
</html>
----
wget -q -O - http://127.0.0.1/test.php3

#*
# (find-angg ".zshrc" "runtmpcgi")
function settmpphp3 () {(
  echo "<html>\n<head>\n<title>PHP3 test $(date)</title>\n<body>"
  if [[ $* -ge 1 ]]; then print -l $*; else cat; fi
  echo "</body>\n</html>"
  ) > /var/www/tmp.php3
}
settmpphp3 <<'---'
<?php echo "Hi, I'm a PHP script!"; ?>
---
wget -q -O - http://127.0.0.1/tmp.php3

#*
cat > /var/www/tmp.php3 <<'---'
<? echo "Foo\n"; ?>
---
wget -q -O - http://127.0.0.1/tmp.php3


#*
# (find-fline "/usr/doc/php3/examples/dir.php3" "<?")
cat > /var/www/tmp.php3 <<'---'
<? $code = "\$dir = opendir(\".\");
  while(\$file = readdir(\$dir)) {
    echo \"\$file \";
  }
  closedir(\$dir);
";
  echo HTMLSpecialChars($code);
?>
Output:
<? eval($code); echo "\n"; ?>
---
wget -q -O - http://127.0.0.1/tmp.php3

#*
# (find-fline "/usr/doc/php3/examples/dir.php3" "<?")
cat > /var/www/tmp.php3 <<'---'
<? $dir = opendir(".");
   while($file = readdir($dir)) { echo "$file "; }
   closedir($dir);
?>
---
wget -q -O - http://127.0.0.1/tmp.php3

#*





#####
#
# First php3 tests using eep and eep-bounded
# 2000jun28
#
#####

# (find-angg ".emacs" "php3")

* (eepitch-php)
* (eepitch-kill)
* (eepitch-php)

echo "Foo\n";

$arr = array("a1" => "a", "a2" => "a", "b0" => "b");
echo join(" .. ", $arr), "\n";
echo 2 == 4, "\n";
if (0) echo "Yes\n"; else echo "No\n";
if (1) echo "Yes\n"; else echo "No\n";
if ("") echo "Yes\n"; else echo "No\n";
if ("0") echo "Yes\n"; else echo "No\n";
if ("a") echo "Yes\n"; else echo "No\n";
if ("no") echo "Yes\n"; else echo "No\n";
echo "2" == 2, "\n";
echo $arr["a1"], "\n";
echo $arr[1], "\n";

function prty($foo) {
  echo "\$foo==$foo; type is " . gettype($foo) . "\n";
}
prty(0 == 1);
$arr = array("a1" => "a", "a2" => "a", "b0" => "b");
prty($arr);
reset($arr);
prty($brr = each($arr));
prty($brr[0]);
prty($brr[1]);
// print join(" .. ", $brr), "\n";
prty(join(" ,, ", each($arr)));
prty(each($arr));
prty(each($arr));
prty(each($arr));
prty(each($arr));

$arr = array("a1" => "a", "a2" => "a", "b0" => "b");
print *$arr, "\n";

function w0($obj) {
  switch(gettype($obj)) {
    case "string":
      echo "\"", $obj, "\"";
      break;
    case "array":
      if (count($obj) == 0) {
        echo "[]";
      } else {
        $sep = "[";
        reset($obj);
        while (list($key, $val) = each($obj)) {
	  echo $sep;
	  w0($key);
	  echo " => ";
	  w0($val);
	  $sep = ", ";
	}
	echo "]";
      }
      break;
    default:
      echo $obj;
  }
}
function w($obj) {
  w0($obj);
  echo "\n";
}

$arr = array("a1" => "a", "a2" => "a", "b0" => "b", 2, 5, "");
w($arr);

#*
// (find-php3hw3 "language.variables.predefined.html")
// Try to call this with "ee '?foo=bar'".
echo $QUERY_STRING, "\n";
echo $foo, "\n";
#*
// (eep-bounded)
// (find-php3fun "array")
// (find-php3fun "ksort")
#*
// (eep-bounded)
// (find-php3hw3 "language.types.type-juggling.html")
#*


#*


#*


cat /var/www/tmp.php3

# (find-php3fun "echo")
# (find-php3hw3 "language.basic-syntax.html")
# (find-php3hw3 "language.types.string.html")
# (find-php3hw3 "language.variables.predefined.html")
# (find-php3hw3 "configuration.html#INI.TRACK-VARS")
# (find-php3hw3 "language.variables.external.html")
# (find-php3fun "eval")

# (find-php3hw3 "feature-fileupload.html")
# (find-php3hw3 "features.file-upload.html")
# (find-php3hw3 "features.images.html")
# (find-php3hw3 "feature-images.html")

# (find-php3hw3 "feature-regexps.html")

# (find-php3fun "header")





#####
#
# phplib
# 2000jun25
#
#####

# (find-status "phplib")
# (find-vldifile "phplib.list")
# (find-fline "/usr/doc/phplib/")

# (find-fline "/usr/lib/phplib/")
# (find-fline "/usr/lib/phplib/stuff/")




#####
#
# php3 source
# 2000jun27
#
#####

cd $SDEBIAN
agrep 'source.*php' ls-lR.i

pdsc $SDEBIAN/dists/potato/main/source/web/php3_3.0.16-2potato3.dsc
cd /usr/src/php3-3.0.16/

# (code-c-d "php3src" "/usr/src/php3-3.0.16/")
# (find-php3srcfile "")
# (find-php3srcfile "functions/")
# (find-php3srcfile "test/")
# (find-php3srcfile "test/README")
# (find-php3srcfile "tests/")

cd /usr/src/php3-3.0.16/
agrep -i post $(find * | grep '\.c$') | l -S

# (find-php3srcfile "functions/post.c")
# (find-php3srcfile "functions/post.c" "void php3_treat_data(")
# (find-php3srcfile "functions/post.h")
# (find-php3srcfile "functions/")
# (find-php3srcfile "main.c" "\"post\"")
# (find-php3srcfile "main.c" "GET data")




#####
#
# php3-mysql
# 2000jul02
#
#####

# «php3-mysql»

# (find-status "php3-mysql")
# (find-vldifile "php3-mysql.list")
# (find-fline "/usr/doc/php3-mysql/")
# (find-fline "/usr/doc/php3-mysql/README.Debian")
# (find-fline "/usr/doc/php3-mysql/README.Debian" "php3-local")

# (find-vldifile "php3.list")
# (find-fline "/etc/php3/apache/php3.ini")
# (find-fline "/etc/php3/apache/php3.ini" "; extension=msql.so")
# Add:
# ; Edrx:
# extension=mysql.so

/etc/init.d/apache restart



#####
#
# template-0.5
# 2000jul26
#
#####

rm -Rv /usr/src/template-0.5/
rm -Rv /var/www/template-0.5/
tar -xvzf $S/http/lide.pruvodce.cz/wayne/template-0.5.tgz -C /usr/src/
tar -xvzf $S/http/lide.pruvodce.cz/wayne/template-0.5.tgz -C /var/www/

cd /usr/src/template-0.5/
# (find-fline "/usr/src/template-0.5/")

lynx http://127.0.0.1/template-0.5/





// (find-php3hw3 "features.file-upload.html")
/***
  o $userfile - The temporary filename in which the uploaded file was
    stored on the server machine.
  o $userfile_name - The original name of the file on the sender's
    system.
  o $userfile_size - The size of the uploaded file in bytes.
  o $userfile_type - The mime type of the file if the browser provided
    this information. An example would be "image/gif".

Note that the "$userfile" part of the above variables is whatever the
name of the INPUT field of TYPE=file is in the upload form. In the
above upload form example, we chose to call it "userfile".
***/



# (find-angg "PHP3/")
# (find-angg "PHP3/functions.php3")

#*
cat > /var/www/tmp.php3 <<'---'
<? include ("/home/root/PHP3/functions.php3");
$a = "foo";
sw('$GLOBALS = ',      $GLOBALS);
sw('$GLOBALS["a"] = ', $GLOBALS["a"]);
?>
---
wget -q -O - 'http://127.0.0.1/tmp.php3?foo=bar'

#*
cat > /var/www/tmp.php3 <<'---'
<?include ("/home/root/PHP3/functions.php3");
  w($HTTP_GET_VARS); ?>
---
wget -q -O - 'http://127.0.0.1/tmp.php3?foo=bar'

#*
cat > /var/www/tmp.php3 <<'---'
<?include ("/home/root/PHP3/functions.php3");
  phpinfo(); ?>
---
wget -q -O - 'http://127.0.0.1/tmp.php3?foo=bar' \
  | tee /tmp/o.html \
  | unhtml

lynx /tmp/o.html

#*




#####
#
# phpnuke
# 2001jul07
#
#####

# «phpnuke»  (to ".phpnuke")
#*
rm -Rv /usr/src/phpnuke-5.0/
mkdir  /usr/src/phpnuke-5.0/
cd     /usr/src/phpnuke-5.0/
tar -xvzf $S/ftp/carroll.cac.psu.edu/pub/linux/distributions/mandrake-devel/projects/phpnuke/PHP-Nuke-5.0.tar.gz

laf html/manual/index.html
rm -v html/manual/index.html

#*
mysqladmin create nuke
cd /usr/src/phpnuke-5.0/sql/
mysql nuke < nuke.sql		|& tee omn

#*
rm -Rv /var/www/nuke/
mkdir  /var/www/nuke/
cd /usr/src/phpnuke-5.0/html/
cp -diPpvR * /var/www/nuke/

# (find-fline "/var/www/nuke/")
# (find-fline "/var/www/nuke/config.php")
# (find-fline "/var/www/nuke/config.php" "$nukeurl = ")
#$nukeurl = "http://127.0.0.1/nuke";

#*
# (find-fline "/etc/apache/srm.conf" "x-httpd-php3")
apti php3-mysql php3-cgi-mysql
/etc/init.d/apache restart
#*
edrxnetscape http://127.0.0.1/nuke/ &

#*

# (find-status "php3-mysql")
# (find-vldifile "php3-mysql.list")
# (find-fline "/usr/doc/php3-mysql/")

# (find-status "php3-cgi-mysql")
# (find-vldifile "php3-cgi-mysql.list")
# (find-fline "/usr/doc/php3-cgi-mysql/")

# (find-status "php3-cgi")
# (find-vldifile "php3-cgi.list")
# (find-fline "/usr/doc/php3-cgi/")




# (code-c-d "phpnuke" "/usr/src/phpnuke-5.0/")
# (find-phpnukefile "")
# (find-phpnukefile "INSTALL" "mysqladmin create nuke")
# (find-phpnukew3 "html/manual/")






(defun eeb-invoke (f sdelim &optional edelim &rest rest)

(defun eephp (s &optional e)
  (eev "wget -q -O - http://127.0.0.1/ee-tmp.php")
  (ee-write-with-nl s e "<?\n" "?>" "/var/www/ee-tmp.php"))



#*
# (eeb-php)
$a = array (1, 2, array ("a", "b", "c")); 
$b = 3.14;
$c = TRUE;                      
var_dump ($a, $b, $c);                            

#*
                                          
/* output:                                
array(3) {                                
  [0]=>                                   
  int(1)                                  
  [1]=>                                   
  int(2)                                  
  [2]=>                                   
  array(3) {                              
    [0]=>                                 
    string(1) "a"                         
    [1]=>                                 
    string(1) "b"                         
    [2]=>                                 
    string(1) "c"                         
  }                                       
}                                         
                                          
*/                                        
                                          
var_dump($b,$c);                          







#####
#
# php5 on etch
# 2007may25
#
#####

# «php5-on-etch»  (to ".php5-on-etch")
# (find-status   "php5")
# (find-vldifile "php5.list")
# (find-udfile   "php5/")
# (find-zsh "availabledebs | sort")
# (find-zsh "availabledebs | sort" "php5")
# (find-zsh "availabledebs | sort" "\nphp5")
# (find-zsh "installeddebs | sort")

# (find-available "libapache-mod-php5")
# (find-available "libapache-mod-php5" "(apache 1.3 module)")
# (find-available "libapache2-mod-php5")
# (find-available "libapache2-mod-php5" "(apache 2 module)")

# (find-sh0 "sudo chown edrx:edrx /etc/php5/apache/php.ini")
# (find-sh0 "sudo chown edrx:edrx /etc/php5/apache2/php.ini")
# (find-fline "/etc/php5/apache/php.ini"  "allow_url_include =")
# (find-fline "/etc/php5/apache2/php.ini" "allow_url_include =")

# (find-fline "/var/www/tmp/")
# (find-fline "/var/www/tmp/test-outer.php")
# (find-fline "/var/www/tmp/test-inner.php")
# (find-fline "/var/www/tmp/foo.php")
# (find-fline "/var/www/tmp/phptest-inc.php")

<?
// This file: (find-fline "/var/www/tmp/test-inner.php")
echo "Hello!";
?>

<?
// This file: (find-fline "/var/www/tmp/test-outer.php")
// See also:  (find-fline "/var/www/tmp/test-inner.php")
require ("http://localhost:80/tmp/test-inner.php");
?>

http://localhost:8080/tmp/test-inner.php
http://localhost:8080/tmp/test-outer.php

sudo /etc/init.d/apache restart



libapache-mod-php5
libapache2-mod-php5




#####
#
# php5
# 2010oct04
#
#####

# «php5-lenny»  (to ".php5-lenny")
# (find-zsh "availabledebs | sort | grep php")
Creating config file /etc/php5/cli/php.ini with new version
/home/edrx(edrx:ho)# apti php5-doc

# (find-status   "php5-cli")
# (find-vldifile "php5-cli.list")
# (find-udfile   "php5-cli/")
# (find-vldifile "php5-cli.postinst")
# (find-vldifile "php5-cli.prerm")
# (find-vldifile "php5-cli.postrm")

# (find-man "1 php5")

* (eepitch-shell)
* (eepitch-kill)
* (eepitch-shell)
php5 -a
<? echo "Hello\n"; ?>
<? echo "Hello\n";
   echo "Foo\n";
?>

# (find-status   "php5-cli")
# (find-vldifile "php5-cli.list")
# (find-udfile   "php5-cli/")
# (find-man "1 php5")




#####
#
# PHP - workshop do Raphael
# 2012may31
#
#####

# «php-raphael-0»  (to ".php-raphael-0")
# (find-angg ".emacs" "php")

# (find-status   "apache2")
# (find-vldifile "apache2.list")
# (find-udfile   "apache2/")
# (find-status   "apache2-doc")
# (find-vldifile "apache2-doc.list")
# (find-udfile   "apache2-doc/")
# (find-fline "/var/www/")

* (eepitch-shell)
* (eepitch-kill)
* (eepitch-shell)
cd /var/www/
ls -laF
sudo chown -v edrx. . *
ls -laF

# (find-fline "/var/www/")
# (find-fline "/var/www/hello.txt")
# (find-fline "/var/www/foo.php")
# http://localhost/
# http://localhost/hello.txt
# http://localhost/foo.php

# (find-status   "php5")
# (find-vldifile "php5.list")
# (find-udfile   "php5/")
# (find-status   "libapache2-mod-php5")
# (find-vldifile "libapache2-mod-php5.list")
# (find-udfile   "libapache2-mod-php5/")
# (find-fline "/etc/init.d/apache2")

* (eepitch-shell)
* (eepitch-kill)
* (eepitch-shell)
sudo /etc/init.d/apache2 restart

# (find-fline "/var/www/")
# (find-fline "/var/www/foo.php")
# http://localhost/foo.php

# (kill-new "<? phpinfo(); ?>")
# (find-fline "/var/www/info.php")
# http://localhost/info.php
# http://localhost/info.php?foo=bar

# «php-raphael»  (to ".php-raphael")
# (find-fline "/var/www/array.php")
# http://localhost/array.php

* (eepitch-shell)
* (eepitch-kill)
* (eepitch-shell)
php /var/www/array.php

# http://localhost/form.php

http://localhost/info.php



# (find-status   "php-elisp")
# (find-vldifile "php-elisp.list")
# (find-udfile   "php-elisp/")




#####
#
# HTTP Header (for content-type, redirect, etc)
# 2012may31
#
#####

# «http-header»  (to ".http-header")
# (find-phpfuncw3m "header.html")
# http://en.wikipedia.org/wiki/Hypertext_Transfer_Protocol
# http://www.w3schools.com/php/func_http_header.asp

<?
//      http://localhost/plain.php
// (find-fline "/var/www/plain.php")
header('Content-type: text/plain');
echo "Hello\nBye";
?>





#####
#
# php-http (supposedly like http-header, but hard to use)
# 2012may31
#
#####

# «php-http»  (to ".php-http")
# (find-status   "php-http")
# (find-vldifile "php-http.list")
# (find-udfile   "php-http/")
# (find-fline "/usr/share/php/HTTP.php")

# (find-phpdocw3m "ref.http.html")
# (find-phpfuncw3m "http-redirect.html")
# (find-phpfuncw3m "http-send-content-type.html")
# (find-phpdocw3m "http.configuration.html")

# http://www.w3schools.com/php/php_ref_http.asp




#####
#
# php 5.6 on wheezy
# 2014jul25
#
#####

# «php-5.6-on-wheezy» (to ".php-5.6-on-wheezy")
# https://wiki.debian.org/DebianUnstable
# https://wiki.debian.org/DebianTesting
# https://wiki.debian.org/DebianUnstable#How_do_I_backport_a_sid_package_to_testing_or_stable.3F
# https://packages.debian.org/source/jessie/php5

# http://ftp.de.debian.org/debian/pool/main/p/php5/php5_5.6.0~rc2+dfsg-4.dsc
# http://ftp.de.debian.org/debian/pool/main/p/php5/php5_5.6.0~rc2+dfsg.orig.tar.xz
# http://ftp.de.debian.org/debian/pool/main/p/php5/php5_5.6.0~rc2+dfsg-4.debian.tar.xz

sudo apt-get build-dep php5

#*
rm -Rv ~/usrc/php5/
mkdir  ~/usrc/php5/
cd $S/http/ftp.de.debian.org/debian/pool/main/p/php5/
cp -v php5_5.6.0~rc2+dfsg* ~/usrc/php5/
cd     ~/usrc/php5/
dpkg-source -sn -x php5_5.6.0~rc2+dfsg-4.dsc
cd     ~/usrc/php5/php5-5.6.0~rc2+dfsg/
dpkg-buildpackage -us -uc -b -rfakeroot     |& tee odb

#*
# (find-fline "~/usrc/php5/")
* (eepitch-shell)
cd ~/usrc/php5/
sudo dpkg -i *.deb

#*
# (code-c-d "php5" "~/usrc/php5/php5-5.6.0~rc2+dfsg/")
# (find-php5file "")


http://serverfault.com/questions/22414/how-can-i-run-debian-stable-but-install-some-packages-from-testing
http://linuxaria.com/howto/how-to-install-a-single-package-from-debian-sid-or-debian-testing




#####
#
# php 5.5 on wheezy
# 2014jul25
#
#####

# «php-5.5-on-wheezy» (to ".php-5.5-on-wheezy")
# http://packages.dotdeb.org/dists/wheezy-php55/
# http://packages.dotdeb.org/dists/wheezy-php55/all/binary-i386/Packages
# http://packages.dotdeb.org/dists/wheezy-php55/php5/binary-i386/

apt-cache policy php5

# http://www.dotdeb.org/2013/11/19/php-5-5-6-for-debian-7-0-wheezy/
# (find-fline "/etc/apt/sources.list")
# deb http://packages.dotdeb.org wheezy all
# deb http://packages.dotdeb.org wheezy all

# (find-zsh "installeddebs | sort | grep php")
# (find-zsh "availabledebs | sort | grep php")

# (find-status   "php-doc")
# (find-vldifile "php-doc.list")
# (find-udfile   "php-doc/")
# (find-phpdocfile "")
# file:///usr/share/doc/php-doc/html/index.html
# file:///usr/share/doc/php-doc/html/indexes.html




#####
#
# php5-doc
# 2012may31 / 2014aug17
#
#####

# «php-doc»  (to ".php-doc")
# (find-angg ".emacs" "php")
# (find-status   "php-doc")
# (find-vldifile "php-doc.list")
# (find-udfile   "php-doc/")
# (find-phpdocfile "")
# file:///usr/share/doc/php-doc/html/index.html
# file:///usr/share/doc/php-doc/html/indexes.html




#####
#
# php5-cli
# 2014aug16
#
#####

# «php5-cli» (to ".php5-cli")
# (find-angg ".emacs" "php")
# http://unix.stackexchange.com/questions/10976/how-do-i-install-a-php-cli-with-a-usable-interactive-prompt-on-debian-wheezy
# http://schlueters.de/blog/archives/133-Now-in-trunk-Improved-interactive-shell.html
# (find-status   "php5-cli")
# (find-vldifile "php5-cli.list")
# (find-udfile   "php5-cli/")
# (find-status   "php5-readline")
# (find-vldifile "php5-readline.list")
# (find-udfile   "php5-readline/")
# (find-man "1 php5")
# (find-fline "/etc/php5/mods-available/")
# (find-fline "/etc/php5/mods-available/readline.ini")

* (eepitch-shell)
* (eepitch-kill)
* (eepitch-shell)
php5 -a
echo "Hello\n";




#####
#
# require and include
# 2014aug17
#
#####

# «require-and-include» (to ".require-and-include")
# http://php.net/manual/en/function.require.php
# file:///usr/share/doc/php-doc/html/function.include.html
# file:///usr/share/doc/php-doc/html/function.include-once.html
# file:///usr/share/doc/php-doc/html/function.require.html
# file:///usr/share/doc/php-doc/html/function.require-once.html

* (eepitch-shell)
* (eepitch-kill)
* (eepitch-shell)
cat > /tmp/foobar.php <<'%%%'
<?php
// file:///usr/share/doc/php-doc/html/language.types.intro.html
$abcd = "ABCD\n";
print("Foo\n");
print("Bar\n");
?>
%%%
php5 -f /tmp/foobar.php


* (eepitch-php)
* (eepitch-kill)
* (eepitch-php)
print($abcd);
include "/tmp/foobar.php";
print($abcd);
require "/tmp/foobar.php";
print($abcd);


// «include_path» (to ".include_path")
// file:///usr/share/doc/php-doc/html/function.set-include-path.html

* (eepitch-php)
* (eepitch-kill)
* (eepitch-php)
include "foobar.php";
set_include_path("/tmp/");
include "foobar.php";





#####
#
# include_path
# 2014aug17
#
#####

# file:///usr/share/doc/php-doc/html/function.echo.html
# file:///usr/share/doc/php-doc/html/function.print.html

# (find-zsh "dmissing php | grep require")
# (find-man "php5")

* (eepitch-php)
* (eepitch-kill)
* (eepitch-php)
echo $include_path, '\n';
echo 22, "\n", 33;




#####
#
# The Facebook SDK for PHP
# 2014aug16
#
#####

# «facebook-sdk» (to ".facebook-sdk")
# (find-es "facebook" "php")
# (find-angg ".emacs" "php")
# (find-phpfbfile "")
# (find-phpfbsrcfile "")
# https://developers.facebook.com/docs/php
# https://developers.facebook.com/docs/reference/php/4.0.0
# https://developers.facebook.com/docs/php/gettingstarted/4.0.0
# https://github.com/facebook/facebook-php-sdk-v4/archive/4.0-dev.zip
# file:///usr/share/doc/php-doc/html/index.html
# file:///usr/share/doc/php-doc/html/indexes.html
# file:///usr/share/doc/php-doc/html/function.defined.html
# file:///usr/share/doc/php-doc/html/language.constants.html

# (find-es "php" "include_path")
# (find-phpfbfile "")
# (find-pfbphfile "autoload.php")
# (find-phpfbfile "autoload.php" "require $file;")
# (find-phpfbfile "autoload.php" "$base_dir =")

* (eepitch-shell)
* (eepitch-kill)
* (eepitch-shell)

// Preparation: run this on a shell.
//
// cd /tmp/
// wget https://github.com/facebook/facebook-php-sdk-v4/archive/4.0-dev.zip
// unzip /tmp/4.0-dev.zip -d /tmp/

define("FACEBOOK_SDK_V4_DIR", "/tmp/facebook-php-sdk-v4-4.0-dev/");
define("FACEBOOK_SDK_V4_SRC_DIR", FACEBOOK_SDK_V4_DIR . "src/Facebook/");
set_include_path(FACEBOOK_SDK_V4_SRC_DIR);
require FACEBOOK_SDK_V4_DIR . "autoload.php";
use Facebook\FacebookSession;
FacebookSession::setDefaultApplication('app-id', 'app-secret');

// ^ this last line yield the error
// PHP Fatal error:  Class 'FacebookSession' not found in php shell code on line N



* (eepitch-shell)
* (eepitch-kill)
* (eepitch-shell)


cd     /tmp/facebook-php-sdk-v4-4.0-dev/




cd /tmp/
cp -v $S/https/github.com/facebook/facebook-php-sdk-v4/archive/4.0-dev.zip .
# wget https://github.com/facebook/facebook-php-sdk-v4/archive/4.0-dev.zip

rm -Rv /tmp/facebook-php-sdk-v4-4.0-dev/
unzip  /tmp/4.0-dev.zip
cd     /tmp/facebook-php-sdk-v4-4.0-dev/

cat > /tmp/test.php <<'%%%'
<?php
define("FACEBOOK_SDK_V4_DIR", "/tmp/facebook-php-sdk-v4-4.0-dev/");
define("FACEBOOK_SDK_V4_SRC_DIR", FACEBOOK_SDK_V4_DIR . "src/Facebook/");
set_include_path(FACEBOOK_SDK_V4_SRC_DIR);
require FACEBOOK_SDK_V4_DIR . "autoload.php";
use Facebook\FacebookSession;
FacebookSession::setDefaultApplication('app-id', 'app-secret');
?>
%%%

php5 /tmp/test.php


# (find-man "php5")


* (eepitch-shell)
* (eepitch-kill)
* (eepitch-shell)
rm -Rv ~/usrc/facebook-php-sdk-v4-4.0-dev/
unzip $S/https/github.com/facebook/facebook-php-sdk-v4/archive/4.0-dev.zip \
    -d ~/usrc/
cd     ~/usrc/facebook-php-sdk-v4-4.0-dev/

(defun eejump-99 ()
  (find-

(find-efunction 'eejump-99*))



* (eepitch-php)
* (eepitch-kill)
* (eepitch-php)
require "/home/edrx/PHP/load_fb_sdk.php";

use Facebook\FacebookSession;

FacebookSession::setDefaultApplication('app-id', 'app-secret');

// If you already have a valid access token:
$session = new FacebookSession('access-token');

// If you're making app-level requests:
$session = FacebookSession::newAppSession();

// To validate the session:
try {
  $session->validate();
} catch (FacebookRequestException $ex) {
  // Session not valid, Graph API returned an exception with the reason.
  echo $ex->getMessage();
} catch (\Exception $ex) {
  // Graph API returned info, but it may mismatch the current app or have expired.
  echo $ex->getMessage();
}



// file:///usr/share/doc/php-doc/html/language.constants.html
// (find-phpfbfile "")
// (find-phpfbfile "docs/FacebookSession.fbmd")

define("FACEBOOK_SDK_V4_DIR", "/home/edrx/usrc/facebook-php-sdk-v4-4.0-dev/");
define("FACEBOOK_SDK_V4_SRC_DIR", FACEBOOK_SDK_V4_DIR . "src/Facebook/");
set_include_path(FACEBOOK_SDK_V4_SRC_DIR);
require FACEBOOK_SDK_V4_DIR . "autoload.php";

use Facebook\FacebookSession;


require "FacebookSession.php";



require FACEBOOK_SDK_V4_DIR . "autoload.php";
set_include_path(FACEBOOK_SDK_V4_SRC_DIR);
require "FacebookSession.php";

$session = new FacebookSession('access token here');
$request = new FacebookRequest($session, 'GET', '/me');
$response = $request->execute();
print($response);
$graphObject = $response->getGraphObject();



echo FACEBOOK_SDK_V4_SRC_DIR . "foo" . "\n";
require FACEBOOK_SDK_V4_SRC_DIR . "autoload";
echo FACEBOOK_SDK_V4_SRC_DIR . "autoload.php" . "\n";

echo FACEBOOK_SDK_V4_SRC_DIR, "\n";


$fb = "FACEBOOK_SDK_V4_SRC_DIR";
define("FACEBOOK_SDK_V4_SRC_DIR", $fb);


define("FACEBOOK_SDK_V4_SRC_DIR",
  "/home/edrx/usrc/facebook-php-sdk-v4-4.0-dev/src/Facebook/");
echo FACEBOOK_SDK_V4_SRC_DIR, "\n";


set_include_path("/home/edrx/usrc/facebook-php-sdk-v4-4.0-dev/src/Facebook/");

require "FacebookSession.php";
$session = new FacebookSession('access token here');

/* (find-fbphpfile "src/Facebook/FacebookSession.php")
 */


$request = new FacebookRequest($session, 'GET', '/me');
$response = $request->execute();
print($response);
$graphObject = $response->getGraphObject();


# http://stackoverflow.com/questions/13265080/wget-to-https-graph-facebook-com-cocacola-error-connection-time-out
# http://stackoverflow.com/questions/6821696/wget-for-fetching-facebook-profile-friend-pages
# http://mongoinsideout.blogspot.be/2014/02/wget-or-xmlhttprequest.html
# http://mongoinsideout.blogspot.com.br/2014/03/facebook.html
# (find-zsh "availabledebs | sort | grep mongo")

# (find-fline "~/snarf/https/developers.facebook.com/docs/")




#####
#
# autoloading
# 2014aug18
#
#####

# «autoload» (to ".autoload")
# http://uk1.php.net/autoload
# http://php.net/get_loaded_extensions




#####
#
# errors
# 2014aug18
#
#####

# «errors» (to ".errors")

<edrx> Naktibalda: I am reading the docs for error_reporting and
       display_errors.





#####
#
# The Boris REPL
# 2014aug24
#
#####

# «boris» (to ".boris")
# http://www.sitepoint.com/say-hello-to-boris-a-better-repl-for-php/
# http://thechangelog.com/meet-boris-a-tiny-repl-for-php/
# http://pem-musing.blogspot.com.br/2014/02/meet-boris-php-too-has-its-repl.html
# https://www.youtube.com/watch?v=xB5fJoX-dws Boris: A Tiny Robust REPL for PHP
# https://www.youtube.com/watch?v=wjkDdYv8au8





#####
#
# naofo.de
# 2016apr10
#
#####

# «naofo.de» (to ".naofo.de")
# https://github.com/naofode/naofo.de
# (find-git-links "https://github.com/naofode/naofo.de" "naofode")
# (code-c-d "naofode" "~/usrc/naofo.de/")
# (find-naofodefile "")

# (find-naofodefile "README.md")
# (find-naofodefile "README.md" "http://wkhtmltopdf.org/")

# http://wkhtmltopdf.org/
# http://code.google.com/p/wkhtmltopdf/
# https://github.com/wkhtmltopdf/wkhtmltopdf

# (find-available "wkhtmltopdf")
# (find-status   "wkhtmltopdf")
# (find-vldifile "wkhtmltopdf.list")
# (find-udfile   "wkhtmltopdf/")
# (find-man "1 wkhtmltopdf")





#  Local Variables:
#  coding:               utf-8-unix
#  End: