<p>Brad Bell <a href="https://craftcms.stackexchange.com/a/1142/1016">mentions this about Craft</a>:</p>

<blockquote>
  <p>Being a self-hosted PHP web application is a hard life. Your parents try to raise you correctly and equip you with the tools necessary to successfully go out into the world and live on some stranger's unknown, unfriendly and oftentimes hostile server environment so you can serve up web pages, but things are stacked against you.</p>
</blockquote>

<p>It's a great read. </p>

<p>I hate to be <em>that</em> guy, but any reason why you don't want to run something more common like MAMP? I haven't used PHP's built in server but there might be little things here and there that you'll pull your hair out over as to why your installation is functioning weirdly and it ends up being a little "quirk" with the PHP web server performing oddly with Yii or something else.</p>

<p>Unless you're just fooling around, it's ideal to run the same software locally as you do on a "live" web server. Some people go so far as to clone the environment they're in (like Vagrant or some other virtual machine), but MAMP works well.</p>

<p>I've used Home Brew and I've even compiled PHP/MySQL/Apache manually on a Mac. It's a great exercise in dependency management, using the command line, and seeing what other packages all go into PHP—there's a ton!—but that's really where it ends. The web server stack is just a tool and MAMP gives me all of that in a simple download that you can easily move/remove. If you have more than one computer, you're going to have to repeat those home brew commands on every Mac you want to test on; MAMP is 3 clicks and I have the stack.</p>

CC BY-SA 3.0
2015-07-05T18:46:11.780Z
2015-07-05T18:46:11.780Z
2017-04-13T12:51:00.200Z
RitterKnight
<p>Mcrypt is a <a href="http://buildwithcraft.com/docs/requirements#required-php-extensions" rel="nofollow">requirement</a> for Craft to run.</p>

<p>There are some <a href="https://secure.php.net/manual/en/mcrypt.installation.php" rel="nofollow">general</a> Mcrypt installation instructions and a <a href="https://craftcms.stackexchange.com/questions/1611/mcrypt-is-required-on-os-x-mavericks-10-9-4">few</a> <a href="https://craftcms.stackexchange.com/questions/262/mcrypt-is-required-on-ubuntu-14-04">posts</a> specifically about installing it for Craft.</p>

CC BY-SA 3.0
2015-07-04T01:47:58.330Z
I just yesterday installed mcrypt on OS X 10.10.3 with homebrew. It went completely smoothly: $ brew install mcrypt; $ brew install php55-mcrypt;. Other times it has been a nightmare, but at the moment I have everything cleanly installed with homebrew (php55, mysql, mcrypt, imagemagick, php55-imagick, php55-mcrypt)
Marion Newlevant
CC BY-SA 3.0
2015-07-04T01:11:59.860Z
2015-07-04T01:11:59.860Z
Brad Bell
<p>With PHP 5.4+ we get a built-in webserver, <a href="http://php.net/manual/en/features.commandline.webserver.php" rel="nofollow">http://php.net/manual/en/features.commandline.webserver.php</a></p>

<p>Has anyone had luck setting this up with Craft? It seems like it could be pretty straightforward, but I am not sure how to wire up a mysql database.</p>

<p>In particular I am hoping to run this with Gulp/BrowserSync so that I can just fire up a livereload instance of Craft quick and easily.</p>

<p>On a very basic pass-through I just did, it seems to kind of work - except it just has 404 pages and a "Craft can’t connect to the database" error.</p>

<p>Here is my gulpfile.js for reference: </p>

<pre><code>gulp.task('php', function() {
    php.server({ base: 'public', port: 8010, keepalive: true});
});

gulp.task('serve', ['php'], function() {
    browserSync.init({
        notify: false,
        reloadOnRestart: true,
        open: false,
        proxy: '127.0.0.1:8010'
    });
    gulp.watch('*.js').on('change', reload);
    gulp.watch("*.html").on('change', reload);
    gulp.watch("*.php").on('change', reload);
});

gulp.task('default', ['serve']);
</code></pre>

<p>Edit: I connected to mysql without much problem (installed using Homebrew, and connecting with 127.0.0.1), but now I am getting:</p>

<blockquote>
  <p>Your server doesn’t meet the following requirements to run Craft:</p>
  
  <p>Mcrypt is required.</p>
</blockquote>

<php><server><mcrypt>
Craft with the PHP Built-in server?
# Craft with the PHP Built-in server?

(Asked by: username_0 on 2015-07-03)

With PHP 5.4+ we get a built-in webserver, http://php.net/manual/en/features.commandline.webserver.php
Has anyone had luck setting this up with Craft? It seems like it could be pretty straightforward, but I am not sure how to wire up a mysql database.
In particular I am hoping to run this with Gulp/BrowserSync so that I can just fire up a livereload instance of Craft quick and easily.
On a very basic pass-through I just did, it seems to kind of work - except it just has 404 pages and a "Craft can’t connect to the database" error.
Here is my gulpfile.js for reference: 
gulp.task('php', function() {
    php.server({ base: 'public', port: 8010, keepalive: true});
});

gulp.task('serve', ['php'], function() {
    browserSync.init({
        notify: false,
        reloadOnRestart: true,
        open: false,
        proxy: '127.0.0.1:8010'
    });
    gulp.watch('*.js').on('change', reload);
    gulp.watch("*.html").on('change', reload);
    gulp.watch("*.php").on('change', reload);
});

gulp.task('default', ['serve']);

Edit: I connected to mysql without much problem (installed using Homebrew, and connecting with 127.0.0.1), but now I am getting:

Your server doesn’t meet the following requirements to run Craft:
Mcrypt is required.

**Tags:** php, server, mcrypt


---

## 2 answers

### Answer by username_1 on 2015-07-05. Score: 1

username_2 [mentions this about Craft](https://craftcms.stackexchange.com/a/1142/1016):

> Being a self-hosted PHP web application is a hard life. Your parents try to raise you correctly and equip you with the tools necessary to successfully go out into the world and live on some stranger's unknown, unfriendly and oftentimes hostile server environment so you can serve up web pages, but things are stacked against you.

It's a great read.

I hate to be *that* guy, but any reason why you don't want to run something more common like MAMP? I haven't used PHP's built in server but there might be little things here and there that you'll pull your hair out over as to why your installation is functioning weirdly and it ends up being a little "quirk" with the PHP web server performing oddly with Yii or something else.

Unless you're just fooling around, it's ideal to run the same software locally as you do on a "live" web server. Some people go so far as to clone the environment they're in (like Vagrant or some other virtual machine), but MAMP works well.

I've used Home Brew and I've even compiled PHP/MySQL/Apache manually on a Mac. It's a great exercise in dependency management, using the command line, and seeing what other packages all go into PHP—there's a ton!—but that's really where it ends. The web server stack is just a tool and MAMP gives me all of that in a simple download that you can easily move/remove. If you have more than one computer, you're going to have to repeat those home brew commands on every Mac you want to test on; MAMP is 3 clicks and I have the stack.


---

### Answer by username_2 on 2015-07-04. Score: 0

Mcrypt is a [requirement](http://buildwithcraft.com/docs/requirements#required-php-extensions) for Craft to run.

There are some [general](https://secure.php.net/manual/en/mcrypt.installation.php) Mcrypt installation instructions and a [few](https://craftcms.stackexchange.com/questions/1611/mcrypt-is-required-on-os-x-mavericks-10-9-4) [posts](https://craftcms.stackexchange.com/questions/262/mcrypt-is-required-on-ubuntu-14-04) specifically about installing it for Craft.

> **Comments:**
> **username_3**: I just yesterday installed mcrypt on OS X 10.10.3 with homebrew. It went completely smoothly: $ brew install mcrypt; $ brew install php55-mcrypt;. Other times it has been a nightmare, but at the moment I have everything cleanly installed with homebrew (php55, mysql, mcrypt, imagemagick, php55-imagick, php55-mcrypt)  

---

