{"_id":"586d0625ee5a4823001444e9","parentDoc":null,"project":"55db8f8f1a91690d007ad975","__v":0,"category":{"_id":"55dc751b00a8811900c230e3","pages":["55dc75b27fa0290d00559123","55dc75c055be9f21004ee24e","55dc75ef00a8811900c230e7","55dc76036f16451700843e0c","55dc760e00a8811900c230e9","55dc767d55be9f21004ee251","55df5db386ae7f0d00db4ccd","55df64cfaf76b70d0060a60e","55df7263c59b180d005fa70e","55e0b72fa44fae0d002148c5","55e0c42b5087cb1900986c0f","55e36b1bac4eef230079a735","55f363ea2d3bae21009c47aa","55f36bcc5f8674370067b73c","55f36c23ec46040d0030326a","5605d2eda4574a0d00811346","560ac5fef6994b0d0023bca6","561be02937781d0d007942b0","56782f0048c8d00d0094b7fc"],"project":"55db8f8f1a91690d007ad975","version":"55db8f901a91690d007ad978","__v":19,"sync":{"url":"","isSync":false},"reference":false,"createdAt":"2015-08-25T14:00:59.500Z","from_sync":false,"order":1,"slug":"how-to-get-started","title":"Agent Installation"},"version":{"_id":"55db8f901a91690d007ad978","project":"55db8f8f1a91690d007ad975","__v":17,"createdAt":"2015-08-24T21:41:36.034Z","releaseDate":"2015-08-24T21:41:36.034Z","categories":["55db8f901a91690d007ad979","55db9856b3d6540d00886426","55dc751b00a8811900c230e3","55dc766255be9f21004ee250","55dc769200a8811900c230ed","55e4c701177b6e0d003330fa","55f4915caf0bc71900a53130","55f491b2be9c2b2100f0635d","560b22739c7be70d00100bd8","57488c53e8c6a420000b729c","574cefd95953e20e00f40f9f","5798edfd7700d30e00ad250c","579ac88234b5fd0e00b9e140","57c81c6d690c200e0047b72e","57d9b8fbda17c30e003897f1","57d9b90e608ea00e00f358d8","57d9b91cda17c30e003897f4"],"is_deprecated":false,"is_hidden":false,"is_beta":false,"is_stable":true,"codename":"","version_clean":"1.0.0","version":"1.0"},"githubsync":"","user":"574c9889a1f0be2000ae376e","updates":[],"next":{"pages":[],"description":""},"createdAt":"2017-01-04T14:26:45.645Z","link_external":false,"link_url":"","sync_unique":"","hidden":false,"api":{"results":{"codes":[]},"settings":"","auth":"required","params":[],"url":""},"isReference":false,"order":8,"body":"[block:image]\n{\n  \"images\": [\n    {\n      \"image\": [\n        \"https://files.readme.io/9ff4a79-php.png\",\n        \"php.png\",\n        1000,\n        500,\n        \"#5d6d93\"\n      ]\n    }\n  ]\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Supported Versions\"\n}\n[/block]\nPHP >= 5.5 with the hash and openssl extensions enabled\n\nOS: Ubuntu or Debian x86 (64-bit only) \n\nOne of the following PHP servers:\n* Apache 2 mod_php\n* PHP-FPM\n* LiteSpeed PHP\n\nSome of the code protection features instrument only specific components, which are thus the only supported component for that code protection feature\nRefer to the following table for restrictions on component instrumented by threat type. N/A indicates that the code protection feature is enabled by default and doesn't require a specific component.\n[block:parameters]\n{\n  \"data\": {\n    \"h-0\": \"Code Protection Feature\",\n    \"h-1\": \"Component Required\",\n    \"0-0\": \"File IO\",\n    \"0-1\": \"N/A\",\n    \"1-0\": \"Remote Command Execution (RCE)\",\n    \"1-1\": \"N/A\",\n    \"2-0\": \"Redirect\",\n    \"2-1\": \"N/A\",\n    \"3-0\": \"SQLi\",\n    \"3-1\": \"PHP Data Objects ([PDO](http://php.net/manual/en/book.pdo.php))\",\n    \"4-0\": \"Cross Site Scripting (XSS)\",\n    \"4-1\": \"N/A\",\n    \"5-0\": \"Eval\",\n    \"5-1\": \"No component required, but must be enabled explicitly in configuration:\\nimmunio.plugins_enabled = eval\"\n  },\n  \"cols\": 2,\n  \"rows\": 6\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Prerequisites\"\n}\n[/block]\nThe IMMUNIO agent communicates with a management service at https://agent.immun.io. Ensure outbound access to this address is unblocked.​\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Installation\"\n}\n[/block]\nThe IMMUNIO agent comes in the form of an SO file you can download by clicking your version of PHP below:\n[block:parameters]\n{\n  \"data\": {\n    \"0-0\": \"[5.5](https://download.immun.io/php/immunio-1.1.0-php-5.5.so)\",\n    \"1-0\": \"\",\n    \"2-0\": \"\",\n    \"3-0\": \"[7.1]([http://download.immun.io/php/beta/immunio-php7.1.so])\",\n    \"h-0\": \"\",\n    \"0-1\": \"[5.6](https://download.immun.io/php/immunio-1.1.0-php-5.6.so)\",\n    \"0-2\": \"[7.0](https://download.immun.io/php/immunio-1.1.0-php-7.0.so)\",\n    \"0-3\": \"[7.1](https://download.immun.io/php/immunio-1.1.0-php-7.1.so)\",\n    \"0-4\": \"[7.2](https://download.immun.io/php/immunio-1.1.0-php-7.2.so)\",\n    \"0-5\": \"\"\n  },\n  \"cols\": 5,\n  \"rows\": 1\n}\n[/block]\nMove the immunio.so file into your PHP extension directory:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"$ mv /path/to/immunio.so \\\"$(php -r 'echo ini_get(\\\"extension_dir\\\");')\\\"\",\n      \"language\": \"shell\"\n    }\n  ]\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Configuration\"\n}\n[/block]\nYou can configure IMMUNIO in your php.ini or custom PHP configuration file with the following parameters:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"# in /path/to/php.ini\\nextension = immunio.so\\nimmunio.key = <your immun.io key>\\nimmunio.secret = <your immun.io secret>\\n\\n; enables code protection plugins\\nimmunio.code_protection_plugins_enabled = true\",\n      \"language\": \"text\"\n    }\n  ]\n}\n[/block]\nYou can add additional configuration options if desired like the ones below:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"; To disable the agent. Agent is still loaded, but won't run.\\nimmunio.agent_enabled = false\\n\\n; Where to log agent information. Defaults to log/immunio.log.\\nimmunio.log_file = < path/to/immunio.log, stdout, stderr or none >\\n\\n; Set the log level. Defaults to info.\\nimmunio.log_level = < off, error, warn, info, debug, trace or all >\\n\\n; Select which plugins are enabled\\nimmunio.plugins_active = file_io,redirect,sqli,xss,shell_command\\n; Disable individual plugins\\nimmunio.plugins_disabled = sqli\\n; Or enable individual plugins\\nimmunio.plugins_enabled = sqli\",\n      \"language\": \"text\"\n    }\n  ]\n}\n[/block]\nYou can also override these using environment variables:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"export IMMUNIO_KEY=<your immun.io key>\\nexport IMMUNIO_SECRET=<your immun.io secret>\\nexport IMMUNIO_AGENT_ENABLED=false\\nexport IMMUNIO_LOG_FILE=path/to/immunio.log\\nexport IMMUNIO_LOG_LEVEL=debug\\nexport IMMUNIO_PLUGINS_DISABLED=file_io\",\n      \"language\": \"text\"\n    }\n  ]\n}\n[/block]\nOnce configuration is complete, restart your PHP server for changes to take effect.\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Verification\"\n}\n[/block]\nOnce the agent is installed and configured, start your application and send an HTTP request to it. Without that first HTTP call, the agent status will display INACTIVE in the dashboard. Within seconds of your first request, the agent should report in and change its status indicator to OK. Your app is now protected with IMMUNIO!​","excerpt":"","slug":"php","type":"basic","title":"PHP"}
[block:image] { "images": [ { "image": [ "https://files.readme.io/9ff4a79-php.png", "php.png", 1000, 500, "#5d6d93" ] } ] } [/block] [block:api-header] { "type": "basic", "title": "Supported Versions" } [/block] PHP >= 5.5 with the hash and openssl extensions enabled OS: Ubuntu or Debian x86 (64-bit only) One of the following PHP servers: * Apache 2 mod_php * PHP-FPM * LiteSpeed PHP Some of the code protection features instrument only specific components, which are thus the only supported component for that code protection feature Refer to the following table for restrictions on component instrumented by threat type. N/A indicates that the code protection feature is enabled by default and doesn't require a specific component. [block:parameters] { "data": { "h-0": "Code Protection Feature", "h-1": "Component Required", "0-0": "File IO", "0-1": "N/A", "1-0": "Remote Command Execution (RCE)", "1-1": "N/A", "2-0": "Redirect", "2-1": "N/A", "3-0": "SQLi", "3-1": "PHP Data Objects ([PDO](http://php.net/manual/en/book.pdo.php))", "4-0": "Cross Site Scripting (XSS)", "4-1": "N/A", "5-0": "Eval", "5-1": "No component required, but must be enabled explicitly in configuration:\nimmunio.plugins_enabled = eval" }, "cols": 2, "rows": 6 } [/block] [block:api-header] { "type": "basic", "title": "Prerequisites" } [/block] The IMMUNIO agent communicates with a management service at https://agent.immun.io. Ensure outbound access to this address is unblocked.​ [block:api-header] { "type": "basic", "title": "Installation" } [/block] The IMMUNIO agent comes in the form of an SO file you can download by clicking your version of PHP below: [block:parameters] { "data": { "0-0": "[5.5](https://download.immun.io/php/immunio-1.1.0-php-5.5.so)", "1-0": "", "2-0": "", "3-0": "[7.1]([http://download.immun.io/php/beta/immunio-php7.1.so])", "h-0": "", "0-1": "[5.6](https://download.immun.io/php/immunio-1.1.0-php-5.6.so)", "0-2": "[7.0](https://download.immun.io/php/immunio-1.1.0-php-7.0.so)", "0-3": "[7.1](https://download.immun.io/php/immunio-1.1.0-php-7.1.so)", "0-4": "[7.2](https://download.immun.io/php/immunio-1.1.0-php-7.2.so)", "0-5": "" }, "cols": 5, "rows": 1 } [/block] Move the immunio.so file into your PHP extension directory: [block:code] { "codes": [ { "code": "$ mv /path/to/immunio.so \"$(php -r 'echo ini_get(\"extension_dir\");')\"", "language": "shell" } ] } [/block] [block:api-header] { "type": "basic", "title": "Configuration" } [/block] You can configure IMMUNIO in your php.ini or custom PHP configuration file with the following parameters: [block:code] { "codes": [ { "code": "# in /path/to/php.ini\nextension = immunio.so\nimmunio.key = <your immun.io key>\nimmunio.secret = <your immun.io secret>\n\n; enables code protection plugins\nimmunio.code_protection_plugins_enabled = true", "language": "text" } ] } [/block] You can add additional configuration options if desired like the ones below: [block:code] { "codes": [ { "code": "; To disable the agent. Agent is still loaded, but won't run.\nimmunio.agent_enabled = false\n\n; Where to log agent information. Defaults to log/immunio.log.\nimmunio.log_file = < path/to/immunio.log, stdout, stderr or none >\n\n; Set the log level. Defaults to info.\nimmunio.log_level = < off, error, warn, info, debug, trace or all >\n\n; Select which plugins are enabled\nimmunio.plugins_active = file_io,redirect,sqli,xss,shell_command\n; Disable individual plugins\nimmunio.plugins_disabled = sqli\n; Or enable individual plugins\nimmunio.plugins_enabled = sqli", "language": "text" } ] } [/block] You can also override these using environment variables: [block:code] { "codes": [ { "code": "export IMMUNIO_KEY=<your immun.io key>\nexport IMMUNIO_SECRET=<your immun.io secret>\nexport IMMUNIO_AGENT_ENABLED=false\nexport IMMUNIO_LOG_FILE=path/to/immunio.log\nexport IMMUNIO_LOG_LEVEL=debug\nexport IMMUNIO_PLUGINS_DISABLED=file_io", "language": "text" } ] } [/block] Once configuration is complete, restart your PHP server for changes to take effect. [block:api-header] { "type": "basic", "title": "Verification" } [/block] Once the agent is installed and configured, start your application and send an HTTP request to it. Without that first HTTP call, the agent status will display INACTIVE in the dashboard. Within seconds of your first request, the agent should report in and change its status indicator to OK. Your app is now protected with IMMUNIO!​