Welke php functie kan je gebruiken om een unix commando uit te voeren?
Antwoord: system
Met welke php functie kan je een verbinding maken met een LDAP server?
Antwoord: ldap_connect
Welk van de volgende is geen voordeel van een windows 2008 server netwerk?
Antwoord: Het is systeem is onafhankelijk van de server(s).
Een admin wachtwoord voor windows 2008 server bevat minstens:
Antwoord: Hoofdletters, kleine letters en cijfers.
Hoeveel ram geheugen heeft een windows 2008 server MINSTENS nodig?
Antwoord: 512 MB
Hoe voeg je een computer toe aan een windows 2008 server domein?
Antwoord: Een beheerder moet de computer registreren bij het domein. Eerst moet op de server een naam aangemaakt worden. Daarna moet op de client via systeeminstellingen de computer lid gemaakt worden.
Windows 2008 server heeft 2 verschillende licentiemodi: per server en per apparaat. Je kan deze modus achteraf eenmalig wijzigen.
Welke ubuntu package moet je installeren voor je php kan gebruiken voor het maken van systeemscripts?
Antwoord: php5-cli
Via welke php functie kan je te weten komen of de huidige gebruiker root is?
Antwoord: posix-geteuid
Maak een systeemscript in php dat, indien je een bestand als argument geeft, een kopie maakt van dat bestand met de extentie .backup. Daarnaast wordt er ook een tweede kopie gemaakt, met de extentie .backup2. Indien je geen argument geeft, of indien het bestand niet bestaat, laat je een duidelijke foutmelding zien.
#!/usr/bin/php5
<?php
if ($argc < 2) {
echo "Geef een bestandsnaam als argument.\n";
exit;
} else {
$naam = $argv[1];
if (file_exists($naam)) {
system("cp ".$naam." ".$naam.".backup");
system("cp ".$naam." ".$naam.".backup2");
}else{
echo "\nBestand bestaat niet!\n";
}
}
?>
Maak een php script dat als argument een getal aanneemt. (Voorzie ook een foutmelding in het geval dit getal ontbreekt.) Het script script toont op het scherm of dit getal even of oneven is.
#!/usr/bin/php5
<?php
if($argc == 2){
$getal = $argv[1];
echo "Het gevraagde getal is";
if ($getal % 2) { echo " niet"; }
echo " even.\n";
}else{
echo "Geef een getal als argument!\n";
}
?>
Maak een php script dat als argument een bestandsnaam krijgt en aan dat bestand, indien het bestaat, een signature toevoegt. Met andere woorden, onder aan het bestand voeg je de onderstaande regels toe (variaties zijn toegelaten):
--
Jan Janssens
6 INF
Antwoord:
#!/usr/bin/php5
<?php
if ($argc < 2) {
echo "Geef een bestandsnaam als argument.\n";
exit;
} else {
$naam = $argv[1];
if (file_exists($naam)) {
$content = file($naam);
$content[] = "\n--";
$content[] = "\nJan Janssens";
$content[] = "\n6 INF\n";
file_put_contents($naam, $content);
}else{
echo "\nBestand bestaat niet!\n";
}
}
?>
Maak een script dat als argument een bestandsnaam aanvaardt. Dat bestand wordt door het script verplaatst (hernoemd) naar bestandsnaam_uur. Waarbij bestandsnaam de ingegeven naam is en uur het uur van de huidige tijd.
<?php
if($argc == 2){
$naam = $argv[1];
$nieuwenaam = $naam."_".date("H");
if(file_exists($naam)){
system("mv ".$naam." ".$nieuwenaam);
}else{
echo "Bestand bestaat niet!\n";
}
}else{
echo "Gelieve een bestandsnaam te geven.\n";
}
?>
General Information
This section holds the most general questions about PHP: what it is and what it does.
- What is PHP?
-
From the preface of the manual:
PHP is an HTML-embedded scripting language. Much of its syntax is borrowed from C, Java and Perl with a couple of unique PHP-specific features thrown in. The goal of the language is to allow web developers to write dynamically generated pages quickly.
- What does PHP stand for?
-
PHP stands for PHP: Hypertext Preprocessor. This confuses many people because the first word of the acronym is the acronym. This type of acronym is called a recursive acronym. For more information, the curious can visit » Free On-Line Dictionary of Computing or the » Wikipedia entry on recursive acronyms.
- What is the relation between the versions?
-
PHP/FI 2.0 is an early and no longer supported version of PHP. PHP 3 is the successor to PHP/FI 2.0 and is a lot nicer. PHP 5 is the current generation of PHP, which uses the » Zend engine 2 which, among other things, offers many additional OOP features.
- Can I run several versions of PHP at the same time?
-
Yes. See the INSTALL file that is included in the PHP source distribution.
- What are the differences between PHP 4 and PHP 5?
-
While PHP 5 was purposely designed to be as compatible as possible with previous versions, there are some significant changes. Some of these changes include:
- A new OOP model based on the Zend Engine 2.0
- A new extension for improved MySQL support
- Built-in native support for SQLite
- A new error reporting constant, E_STRICT, for run-time code suggestions
- A host of new functions to simplify code authoring (and reduce the need to write your own functions for many common procedures)
- I think I found a bug! Who should I tell?
-
You should go to the PHP Bug Database and make sure the bug isn't a known bug. If you don't see it in the database, use the reporting form to report the bug. It is important to use the bug database instead of just sending an email to one of the mailing lists because the bug will have a tracking number assigned and it will then be possible for you to go back later and check on the status of the bug. The bug database can be found at » http://bugs.php.net/.
