|
| 1 | +<!DOCTYPE html> |
| 2 | +<html xmlns="http://www.w3.org/1999/xhtml"> |
| 3 | + <head> |
| 4 | + <meta http-equiv="Content-Type" content="text/html; charset=us-ascii"> |
| 5 | + <meta name="viewport" content="width=device-width, initial-scale=1.0"> |
| 6 | + <title>Writing a PHP App | Cloud9 User Documentation</title> |
| 7 | + <link href="./assets/min/styles.css" rel="stylesheet" type="text/css"> |
| 8 | + <link rel="icon" type="image/x-icon" href="./assets/img/favicon.ico"> |
| 9 | + <link href="https://fonts.googleapis.com/css?family=Inconsolata" rel="stylesheet" type="text/css"> |
| 10 | + </head> |
| 11 | + <body> |
| 12 | + <iframe id="header_iframe" height="50px" width="100%" src="" scrolling="no" frameborder="0"></iframe> |
| 13 | + <div id="wrapper" class="wrapper"> |
| 14 | + <div class="container"> |
| 15 | + <div class="row"> |
| 16 | + <div class="span3"> |
| 17 | + <div class="sidebar-nav"> |
| 18 | + <div id="search-header"> |
| 19 | + <form> |
| 20 | + <input id="st-search-input" name="search" type="text" value="" title="Press Enter for results" placeholder="Search the docs" style="width: 182px" class="input focused span3 st-search-input"> |
| 21 | + </form> |
| 22 | + </div> |
| 23 | + <div id="st-results-container"></div> |
| 24 | + <div id="doc-nav" class="scroll-pane"> |
| 25 | + <ul id="nav"> |
| 26 | + <li class="nav-section"> |
| 27 | + <div class="nav-section-header"><a href="index.html">Home</a></div> |
| 28 | + </li> |
| 29 | + <!-- li.nav-section--> |
| 30 | + <!-- .nav-section-header--> |
| 31 | + <!-- a(href='https://www.youtube.com/user/c9ide/videos?flow=grid&view=1', target='_blank') Video Tutorials--> |
| 32 | + <li class="nav-section"> |
| 33 | + <div class="nav-section-header"><a href="javascript:void(0)">Getting Started</a><i class="icon-chevron-down tocNavArrow"></i><i class="icon-chevron-up tocNavArrow"></i></div> |
| 34 | + <ul> |
| 35 | + <li class="nav-submenu-item"><a href="create_a_workspace.html">Create a workspace</a></li> |
| 36 | + <li class="nav-submenu-item"><a href="run_an_application.html">Run an application</a></li> |
| 37 | + <li class="nav-submenu-item"><a href="setup_a_database.html">Set up a database</a></li> |
| 38 | + <li class="nav-submenu-item"><a href="share_a_workspace.html">Share a workspace</a></li> |
| 39 | + </ul> |
| 40 | + </li> |
| 41 | + <li class="nav-section"> |
| 42 | + <div class="nav-section-header"><a href="javascript:void(0)">Features</a><i class="icon-chevron-down tocNavArrow"></i><i class="icon-chevron-up tocNavArrow"></i></div> |
| 43 | + <ul> |
| 44 | + <li class="nav-submenu-item"><a href="supported_languages.html">Supported Languages</a></li> |
| 45 | + <li class="nav-submenu-item"><a href="syntax_highlighting_themes.html">Syntax Highlighting & Themes</a></li> |
| 46 | + <!-- li.nav-submenu-item--> |
| 47 | + <!-- a(href='collaboration.html') Collaboration--> |
| 48 | + <!-- li.nav-submenu-item--> |
| 49 | + <!-- a(href='colorpicker.html') Color Picker--> |
| 50 | + <li class="nav-submenu-item"><a href="multiple_cursors.html">Multiple Cursors</a></li> |
| 51 | + <!-- li.nav-submenu-item--> |
| 52 | + <!-- a(href='revisions.html') Revisions--> |
| 53 | + <li class="nav-submenu-item"><a href="language_analysis.html">Language Analysis</a></li> |
| 54 | + <li class="nav-submenu-item"><a href="autocompletion.html">Code Autocompletion</a></li> |
| 55 | + <!-- li.nav-submenu-item--> |
| 56 | + <!-- a(href='uploading_downloading.html') Uploading Files and Downloading Your Project--> |
| 57 | + <!-- li.nav-submenu-item--> |
| 58 | + <!-- a(href='gotofile_and_definition.html') Using Goto File and Goto Definition--> |
| 59 | + <li class="nav-submenu-item"><a href="searching_in_files.html">Searching and Replacing in Files</a></li> |
| 60 | + <!-- li.nav-submenu-item--> |
| 61 | + <!-- a(href='git_blame.html') Git Blame--> |
| 62 | + <!-- li.nav-submenu-item--> |
| 63 | + <!-- a(href='zen_mode.html') Zen Mode--> |
| 64 | + <li class="nav-submenu-item"><a href="custom_runners.html">Custom Runners</a></li> |
| 65 | + </ul> |
| 66 | + </li> |
| 67 | + <li class="nav-section"> |
| 68 | + <div class="nav-section-header"><a href="javascript:void(0)">IDE Components</a><i class="icon-chevron-down tocNavArrow"></i><i class="icon-chevron-up tocNavArrow"></i></div> |
| 69 | + <ul> |
| 70 | + <!-- li.nav-submenu-item--> |
| 71 | + <!-- a(href='ide_overview.html') IDE Overview--> |
| 72 | + <li class="nav-submenu-item"><a href="the_editor.html">The Editor</a></li> |
| 73 | + <!-- li.nav-submenu-item--> |
| 74 | + <!-- a(href='console.html') The Console--> |
| 75 | + <li class="nav-submenu-item"><a href="dashboard.html">The Dashboard</a></li> |
| 76 | + <!-- li.nav-submenu-item--> |
| 77 | + <!-- a(href='project_bar.html') The Project Bar--> |
| 78 | + <!-- li.nav-submenu-item--> |
| 79 | + <!-- a(href='status_bar.html') The Status Bar--> |
| 80 | + <!-- li.nav-submenu-item--> |
| 81 | + <!-- a(href='terminal.html') The Terminal--> |
| 82 | + <!-- li.nav-submenu-item--> |
| 83 | + <!-- a(href='ide_preferences.html') IDE Preferences--> |
| 84 | + <!-- li.nav-submenu-item--> |
| 85 | + <!-- a(href='tab_functions.html') Tab Functions--> |
| 86 | + <!-- li.nav-submenu-item--> |
| 87 | + <!-- a(href='keybindings.html') Commands and Keybindings--> |
| 88 | + </ul> |
| 89 | + </li> |
| 90 | + <li class="nav-section"> |
| 91 | + <div class="nav-section-header"><a href="javascript:void(0)">Creating Workspaces</a><i class="icon-chevron-down tocNavArrow"></i><i class="icon-chevron-up tocNavArrow"></i></div> |
| 92 | + <ul> |
| 93 | + <li class="nav-submenu-item"><a href="creating_new_workspace.html">Creating a New Workspace</a></li> |
| 94 | + <li class="nav-submenu-item"><a href="ssh_workspaces.html">Setting up SSH Workspaces</a></li> |
| 95 | + <li class="nav-submenu-item"><a href="setting_up_github_workspace.html">Setting up a GitHub Workspace</a></li> |
| 96 | + <li class="nav-submenu-item"><a href="setting_up_bitbucket_workspace.html">Setting up a Bitbucket Workspace</a></li> |
| 97 | + <li class="nav-submenu-item"><a href="setting_up_gitlab_workspace.html">Setting up a GitLab Workspace</a></li> |
| 98 | + <li class="nav-submenu-item"><a href="ftp_workspaces.html">Creating an FTP Workspace</a></li> |
| 99 | + <li class="nav-submenu-item"><a href="run_your_own_workspace.html">Running Your Own SSH Workspace</a></li> |
| 100 | + </ul> |
| 101 | + </li> |
| 102 | + <li class="nav-section"> |
| 103 | + <div class="nav-section-header"><a href="javascript:void(0)">Running and Debugging Code</a><i class="icon-chevron-down tocNavArrow"></i><i class="icon-chevron-up tocNavArrow"></i></div> |
| 104 | + <ul> |
| 105 | + <li class="nav-submenu-item"><a href="running_and_debugging_code.html">Running and Debugging Your Code</a></li> |
| 106 | + <li class="nav-submenu-item"><a href="common_errors.html">Common Errors</a></li> |
| 107 | + <li class="nav-submenu-item"><a href="terminal_monitor.html">Terminal Monitor</a></li> |
| 108 | + <li class="nav-submenu-item"><a href="writing_nodejs_hello_world.html">Writing a Node.js App</a> |
| 109 | + <ul> |
| 110 | + <li class="nav-submenu-item"><a href="installing_npm_modules.html">Installing NPM Modules</a></li> |
| 111 | + <li class="nav-submenu-item"><a href="creating_coffeescript_app.html">Creating a Coffeescript App</a></li> |
| 112 | + </ul> |
| 113 | + </li> |
| 114 | + <li class="nav-submenu-item"><a href="writing_a_python_app.html">Writing a Python App</a> |
| 115 | + <ul> |
| 116 | + <li class="nav-submenu-item"><a href="installing_python_packages.html">Installing Python Packages</a></li> |
| 117 | + </ul> |
| 118 | + </li> |
| 119 | + <li class="nav-submenu-item"><a href="writing_a_ruby_app.html">Writing a Ruby App</a> |
| 120 | + <ul> |
| 121 | + <li class="nav-submenu-item"><a href="installing_ruby_gems.html">Installing Ruby Gems</a></li> |
| 122 | + <li class="nav-submenu-item"><a href="running_a_rails_app.html">Running a Rails App</a></li> |
| 123 | + </ul> |
| 124 | + </li> |
| 125 | + <li class="nav-submenu-item"><a href="writing_a_php_app.html">Writing a PHP App</a> |
| 126 | + <ul> |
| 127 | + <li class="nav-submenu-item"><a href="editing_wordpress_sites.html">Editing Remote WordPress Websites</a></li> |
| 128 | + <li class="nav-submenu-item"><a href="running_wordpress_on_cloud9.html">Running WordPress on Cloud9</a></li> |
| 129 | + </ul> |
| 130 | + </li> |
| 131 | + <li class="nav-submenu-item"><a href="writing_a_go_app.html">Writing a Go App</a></li> |
| 132 | + </ul> |
| 133 | + </li> |
| 134 | + <li class="nav-section"> |
| 135 | + <div class="nav-section-header"><a href="javascript:void(0)">Database and Persistence</a><i class="icon-chevron-down tocNavArrow"></i><i class="icon-chevron-up tocNavArrow"></i></div> |
| 136 | + <ul> |
| 137 | + <li class="nav-submenu-item"><a href="setting_up_mysql.html">Using MySQL</a></li> |
| 138 | + <li class="nav-submenu-item"><a href="setting_up_mongodb.html">Using MongoDB</a></li> |
| 139 | + <li class="nav-submenu-item"><a href="setting_up_postgresql.html">Using PostgreSQL</a></li> |
| 140 | + <li class="nav-submenu-item"><a href="setting_up_redis.html">Using Redis</a></li> |
| 141 | + <li class="nav-submenu-item"><a href="setting_up_sqlite3.html">Using SQLite</a></li> |
| 142 | + </ul> |
| 143 | + </li> |
| 144 | + <li class="nav-section"> |
| 145 | + <div class="nav-section-header"><a href="javascript:void(0)">Deploying Code</a><i class="icon-chevron-down tocNavArrow"></i><i class="icon-chevron-up tocNavArrow"></i></div> |
| 146 | + <ul> |
| 147 | + <!-- li.nav-submenu-item--> |
| 148 | + <!-- a(href='deploying_code.html') Deploying Your Code--> |
| 149 | + <!-- li.nav-submenu-item--> |
| 150 | + <!-- a(href='deploying_to_heroku.html') Deploying to Heroku--> |
| 151 | + <!-- li.nav-submenu-item--> |
| 152 | + <!-- a(href='deploying_to_windows_azure_sites.html') Deploying to Windows Azure Sites--> |
| 153 | + <li class="nav-submenu-item"><a href="deploying_via_cli.html">Deploying via the Command Line</a></li> |
| 154 | + </ul> |
| 155 | + </li> |
| 156 | + <li class="nav-section"> |
| 157 | + <div class="nav-section-header"><a href="javascript:void(0)">Popular Frameworks</a><i class="icon-chevron-down tocNavArrow"></i><i class="icon-chevron-up tocNavArrow"></i></div> |
| 158 | + <ul> |
| 159 | + <li class="nav-submenu-item"><a href="frameworks_angularjs.html">AngularJS</a></li> |
| 160 | + <li class="nav-submenu-item"><a href="frameworks_drupal.html">Drupal</a></li> |
| 161 | + <li class="nav-submenu-item"><a href="frameworks_express.html">Express</a></li> |
| 162 | + <li class="nav-submenu-item"><a href="frameworks_ghost.html">Ghost</a></li> |
| 163 | + <li class="nav-submenu-item"><a href="frameworks_ionic.html">Ionic</a></li> |
| 164 | + <li class="nav-submenu-item"><a href="frameworks_jekyll.html">Jekyll</a></li> |
| 165 | + <li class="nav-submenu-item"><a href="frameworks_joomla.html">Joomla</a></li> |
| 166 | + <li class="nav-submenu-item"><a href="frameworks_koa.html">KoaJS</a></li> |
| 167 | + <li class="nav-submenu-item"><a href="frameworks_laravel.html">Laravel</a></li> |
| 168 | + <li class="nav-submenu-item"><a href="frameworks_meteor.html">Meteor</a></li> |
| 169 | + <li class="nav-submenu-item"><a href="frameworks_symfony2.html">Symfony</a></li> |
| 170 | + </ul> |
| 171 | + </li> |
| 172 | + <li class="nav-section"> |
| 173 | + <div class="nav-section-header"><a href="javascript:void(0)">FAQ</a><i class="icon-chevron-down tocNavArrow"></i><i class="icon-chevron-up tocNavArrow"></i></div> |
| 174 | + <ul> |
| 175 | + <li class="nav-submenu-item"><a href="faq_general.html">General</a></li> |
| 176 | + <li class="nav-submenu-item"><a href="faq_php.html">PHP</a></li> |
| 177 | + <li class="nav-submenu-item"><a href="faq_python.html">Python</a></li> |
| 178 | + <li class="nav-submenu-item"><a href="faq_ssh.html">SSH workspaces</a></li> |
| 179 | + </ul> |
| 180 | + </li> |
| 181 | + <div class="alert alert-info">These articles are <a href="https://www.github.com/c9/docs.c9.io">open source</a>! Feel free to pull and contribute.</div> |
| 182 | + </ul> |
| 183 | + </div> |
| 184 | + </div> |
| 185 | + </div> |
| 186 | + <div class="span12 documentationContainer"> |
| 187 | + <div id="content"> |
| 188 | + <div id="toh_btn" onclick="toggleTOH(this)"></div> |
| 189 | + <h1>Writing a PHP App</h1> |
| 190 | + <div><p>With Cloud9 IDE, you can run your PHP pages, without relying on a third-party system like Apache hosting. We run PHP version 5.5.9.</p> |
| 191 | +<p>You can choose to run PHP scripts via the command line, by typing <code>php</code>, followed by the name of your PHP file. However, this is not a very common use case. Most likely, you'll be running your own server and hosting PHP files.</p> |
| 192 | +<p>Here's a simple demonstration. First, create a PHP file called <em>hello_world.php</em>, and paste this code into it:</p> |
| 193 | +<pre><code class="language-xml"><span class="tag"><<span class="title">html</span>></span> |
| 194 | + <span class="tag"><<span class="title">head</span>></span> |
| 195 | + <span class="tag"><<span class="title">title</span>></span>PHP Test<span class="tag"></<span class="title">title</span>></span> |
| 196 | + <span class="tag"></<span class="title">head</span>></span> |
| 197 | + <span class="tag"><<span class="title">body</span>></span> |
| 198 | + <span class="pi"><?php echo '<p>Hello World</p>'; ?></span> |
| 199 | + <span class="tag"></<span class="title">body</span>></span> |
| 200 | +<span class="tag"></<span class="title">html</span>></span></code></pre> |
| 201 | +<p>Next, open the <strong>Run & Debug</strong> panel, at the left of the IDE. From the <strong>Runtime</strong> dropdown, select <strong>Apache+PHP</strong>. Then, click on the <img src="./resources/icons/runButton.png" alt="The Run Button" width="" height=""> button in the top menu bar.</p> |
| 202 | +<p>The console should now spit out a message about how your Apache server is running, something similar to this:</p> |
| 203 | +<pre><code class="language-no-highlight">Running Apache Process |
| 204 | +Tip: you can access long running processes, like a server, at 'http://php_hello.gjtorikian.c9.io'.</code></pre> |
| 205 | +<p>Clicking on that link gets you to your PHP page. For a more in-depth workflow, see the article on <a href="./running_wordpress_on_cloud9.html">running WordPress entirely on Cloud9</a>.</p> |
| 206 | +<h2 id='modifying-phpini'><a class='heading_anchor' href='#modifying-phpini'><i class='headerLinkIcon'></i></a>Modifying php.ini</h2> |
| 207 | +<p>You can configure your PHP installation by editing the <code>php.ini</code> located in the <code>/home/ubuntu/workspace</code> directory. Please note: in some cases <code>php.ini</code> is located somewhere else. Just create a simple PHP file running <code>phpinfo()</code> to find out where to look for <code>php.ini</code>.</p> |
| 208 | +<p>Make sure to restart Apache after you have applied your changes</p> |
| 209 | +<pre><code>apachectl re<span class="operator"><span class="keyword">start</span></code></pre> |
| 210 | +<div class="alert alert-success"><h4 class="alert-heading">Note: </h4>Currently, you can't debug PHP applications yet, but we are working on adding this feature. |
| 211 | +</div> |
| 212 | + |
| 213 | + </div> |
| 214 | + <div id="disqus_thread"></div> |
| 215 | + </div> |
| 216 | + </div> |
| 217 | + <div id="tocHolder" class="span2"></li><ol class='tocContainer level_1'><li class='tocItem level_2'><a href='#modifying-phpini'>Modifying php.ini</a></li></ol></li></ol> |
| 218 | + </div> |
| 219 | + </div> |
| 220 | + <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.0/jquery.min.js" type="text/javascript"></script> |
| 221 | + <script src="./assets/min/javascripts.js" type="text/javascript"></script> |
| 222 | + </div> |
| 223 | + <div class="push"></div> |
| 224 | + </div> |
| 225 | + <footer> |
| 226 | + <iframe id="footer_iframe" height="290px" width="100%" src="" scrolling="no" frameborder="0"></iframe> |
| 227 | + </footer> |
| 228 | + </body> |
| 229 | +</html> |
0 commit comments