[{"data":1,"prerenderedAt":182},["ShallowReactive",2],{"extension:v3:en:php":3},{"resolvedFromAlias":4,"canonicalExt":5,"ext":5,"name":6,"category":7,"categoryName":8,"updatedAt":9,"popularity":10,"summary":11,"howToOs":12,"quickAnswer":18,"answerIntro":19,"whatIs":20,"description":21,"furtherReading":22,"openInstructions":38,"commonIssues":51,"securityNotes":70,"faq":75,"aliases":88,"mimeTypes":89,"relatedExtensions":91,"breadcrumbs":139,"categoryAnchor":149,"categoryFuturePath":150,"metaDescription":151,"availableHowToOs":152,"openOnDeviceLinks":153,"cannotOpenReasons":169,"cannotOpenFixes":170,"convertOptions":171,"securityAffiliateMessaging":172,"securityAffiliates":173},false,"php","PHP script (PHP source code)","code","Code","2026-06-12T09:02:13.495Z",85,".php files typically contain PHP source code used on web servers to generate dynamic web pages and API responses. You can open them in a code editor, but they are usually executed by a web server (often via PHP-FPM) rather than “run” like a normal desktop app.",[13,14,15,16,17],"windows","mac","linux","ios","android","To open .PHP files on Windows, right-click the .php file → Open with → Visual Studio Code (or another code editor) to view/edit the source.","To open a .php file, use a code editor such as Visual Studio Code to view and edit the PHP source. If you expected a web page, upload it to a server configured to execute PHP (commonly via PHP-FPM or an Apache PHP handler) and access it through a browser.","A .php file is plain-text source code written for the PHP server-side scripting language. In typical web setups, the server executes the PHP code and returns the generated output (often HTML) to the client, rather than sending the raw .php source to the browser. On many systems, file associations and web servers may map .php to a PHP-related MIME type for handling.","PHP is a widely used server-side scripting language designed for web development. In practice, a .php file usually contains a mixture of PHP code and output templates that produce HTML or other response formats when executed on a server.\n\nHow a .php file behaves depends on context. In a code editor, it’s just text you can read and modify. In a web server environment, the server is configured so that requests for .php are handled by a PHP runtime (for example, PHP-FPM) and the result is returned to the browser.\n\nWeb server integration is commonly done either via FastCGI (PHP-FPM is the process manager used for this model) or via server-specific handlers. Configuration details vary by server, but the goal is the same: execute PHP scripts securely and efficiently when a .php resource is requested.",[23,26,29,32,35],{"title":24,"url":25},"PHP (Wikipedia) — overview of PHP as a server-side scripting language","https://en.wikipedia.org/wiki/PHP",{"title":27,"url":28},"PHP Manual — FastCGI Process Manager (PHP-FPM)","https://www.php.net/manual/en/install.fpm.php",{"title":30,"url":31},"PHP in Visual Studio Code — editing and language support","https://code.visualstudio.com/docs/languages/php",{"title":33,"url":34},"MDN — Common MIME types (includes application/x-httpd-php for .php)","https://developer.mozilla.org/docs/Web/HTTP/Guides/MIME_types/Common_types",{"title":36,"url":37},"IANA Media Types registry — official standardized MIME types","https://www.iana.org/assignments/media-types/",{"windows":39,"macos":42,"linux":45,"ios":48,"android":50},[40,41],"Right-click the .php file → Open with → Visual Studio Code (or another code editor) to view/edit the source.","If you need it to execute as a web page, place it on a web server that’s configured to run PHP (for example, using PHP-FPM or an Apache PHP handler), then open the corresponding URL in a browser.",[43,44],"Open the .php file in a code editor (for example, Visual Studio Code) to view/edit the PHP source.","To see the generated web output, run it through a configured web server with PHP support (commonly via PHP-FPM) and open it in a browser via the server URL.",[46,47],"Open the .php file in a code editor such as Visual Studio Code to view/edit the source code.","To execute it as a web script, configure your web server to pass .php requests to PHP (commonly via PHP-FPM) and access it via http:// or https://.",[49],".php files are typically edited and executed in a server environment; for reliable viewing/editing, transfer the file to a desktop OS and open it in a code editor like Visual Studio Code.",[49],[52,58,64],{"title":53,"description":54,"steps":55},"Browser shows PHP source code instead of a web page","This usually means the server is not executing PHP for .php files and is serving them as plain text (a misconfiguration that can also leak secrets in the code).",[56,57],"Verify the site is hosted on a server configured to execute PHP (for example using PHP-FPM) rather than a static file host.","Check your web server configuration to ensure .php requests are handled by PHP (for Apache, confirm the PHP handler configuration).",{"title":59,"description":60,"steps":61},"Double-clicking a .php file doesn’t “run” it",".php is source code intended to be executed by a PHP runtime, typically through a web server request; opening it directly usually just shows the text in an editor.",[62,63],"Open the file in a code editor (such as Visual Studio Code) to inspect or edit it.","If you need to see its output, run it on a PHP-enabled web server (commonly with PHP-FPM) and view it through a browser.",{"title":65,"description":66,"steps":67},"Web server returns an unexpected content type for .php","Servers may label PHP-related responses with non-standard or configuration-dependent MIME types (commonly seen as application/x-httpd-php), which can confuse tooling or downloads.",[68,69],"If you control the server, review how it maps .php to handlers and content types; ensure PHP is executed and the response is sent with an appropriate type for the generated output (often text/html for HTML pages).","If you do not control the server, treat the .php file as source code and open it in an editor rather than relying on browser rendering.",[71,72,73,74],".php files can contain executable server-side code. Never deploy a .php file from an untrusted source on a server, because it may execute actions with your server’s permissions.","If a server is misconfigured to serve .php as plain text, the source code (including passwords, API keys, or database credentials embedded in scripts) can be exposed to visitors.","Avoid treating .php as a “document” to open in a browser from local disk expecting safe output; the PHP code is not executed locally by the browser and you may misinterpret what it does when run on a server.","Be cautious with file upload features on websites: allowing users to upload .php (or upload files into executable directories) can enable remote code execution if the server executes uploaded scripts.",[76,79,82,85],{"question":77,"answer":78},"Is a .php file a web page?","It’s usually the server-side source code used to generate a web page or API response. The browser typically receives the output produced by running the script, not the .php source itself.",{"question":80,"answer":81},"What program should I use to open a .php file?","Use a code editor to view and edit it. Visual Studio Code has documented PHP language support for working with .php files.",{"question":83,"answer":84},"What MIME type is associated with .php?","A commonly used (but non-standard) MIME type seen for PHP is application/x-httpd-php. MIME handling can vary by server configuration, and the correct response type often depends on what the script outputs (for example, HTML).",{"question":86,"answer":87},"How do .php files run on a server?","Web servers are configured to route .php requests to a PHP runtime. A common approach is using PHP-FPM (FastCGI Process Manager) so the server can execute the script and return the generated response.",[],[90],"application/x-httpd-php",[92,97,103,109,115,121,127,133],{"ext":93,"name":94,"category":7,"categoryName":8,"popularity":10,"summary":95,"howToOs":96},"sql","SQL script (Structured Query Language)",".sql files contain SQL statements (queries, schema definitions, and data changes) that can be run by a database tool or opened as plain text for review and editing.",[13,14,15,16,17],{"ext":98,"name":99,"category":7,"categoryName":8,"popularity":100,"summary":101,"howToOs":102},"cs","C# source code file",80,".cs files contain C# source code used to build .NET applications and libraries. They are plain-text files typically edited in code editors and IDEs such as Visual Studio Code with C# tooling.",[13,14,15,16,17],{"ext":104,"name":105,"category":7,"categoryName":8,"popularity":106,"summary":107,"howToOs":108},"go","Go source file",78,".go files contain source code written in the Go (Golang) programming language. You can open them in code editors (for reading/editing) or build/run them with the Go toolchain.",[13,14,15,16,17],{"ext":110,"name":111,"category":7,"categoryName":8,"popularity":112,"summary":113,"howToOs":114},"tsx","TypeScript JSX (TSX) source file",75,".tsx is a TypeScript source code file that contains JSX syntax, commonly used with React-style UI components. You open it in a code editor (for viewing/editing) and build it with TypeScript tooling (for running in apps).",[13,14,15,16,17],{"ext":116,"name":117,"category":7,"categoryName":8,"popularity":118,"summary":119,"howToOs":120},"kt","Kotlin source file",72,".kt files contain Kotlin source code used to build Kotlin applications (including Android apps) and libraries. You typically open them in a code editor or IDE such as IntelliJ IDEA or Android Studio.",[13,14,15,16,17],{"ext":122,"name":123,"category":7,"categoryName":8,"popularity":124,"summary":125,"howToOs":126},"swift","Swift Source Code",70,".swift is a Swift programming language source file used to write apps and other software. You open it in code editors and IDEs such as Xcode or other text/code editors.",[13,14,15,16,17],{"ext":128,"name":129,"category":7,"categoryName":8,"popularity":130,"summary":131,"howToOs":132},"dart","Dart source code",65,".dart files contain source code written in the Dart programming language. You open them in a code editor/IDE or work with them using the Dart SDK tools.",[13,14,15,16,17],{"ext":134,"name":135,"category":7,"categoryName":8,"popularity":136,"summary":137,"howToOs":138},"proto","Protocol Buffers schema (Protocol Buffers definition file)",60,".proto files define data structures and services for Google’s Protocol Buffers. They are plain-text schemas that you open in a text editor/IDE or compile with the Protocol Buffers compiler (protoc) to generate code.",[13,14,15,16,17],[140,143,146],{"label":141,"to":142},"Home","/",{"label":144,"to":145},"File Extension Index","/file-extension",{"label":147,"to":148},".PHP","/file-extension/php","category-code","/category/code","Learn what .PHP files are, how to open them on every platform, common fixes, and security best practices.",[13,14,15,16,17],[154,157,160,163,166],{"os":13,"label":155,"to":156},"Open .PHP on Windows","/how-to/open-php-on-windows",{"os":14,"label":158,"to":159},"Open .PHP on Mac","/how-to/open-php-on-mac",{"os":15,"label":161,"to":162},"Open .PHP on Linux","/how-to/open-php-on-linux",{"os":16,"label":164,"to":165},"Open .PHP on iOS","/how-to/open-php-on-ios",{"os":17,"label":167,"to":168},"Open .PHP on Android","/how-to/open-php-on-android",[53,59,65],[56,57],[],"code_runtime",[174,178],{"name":175,"description":176,"affiliateUrl":177},"Avast","Avast offers free and premium antivirus software that protects against viruses, malware, ransomware, and phishing. Scan files before opening them to ensure safety.","https://www.avast.com/lp-aff-consumer-store?expid=inf601",{"name":179,"description":180,"affiliateUrl":181},"Norton","Norton 360 delivers comprehensive antivirus protection, VPN, and identity theft monitoring. Scan files for threats before opening to keep your device secure.","http://buy.norton.com/aff_home?utm_campaign=en-ww_nor_n36_aff_nas_nau_nah_cj_nad_low:_sec_nat_mktc_norton_360",1781269501161]