D
David Berger
Guest
Modulus supports the seamless deployment of PHP applications. The PHP runtime supports multiple version of PHP and is served with an nginx frontend. CREATE PROJECT Creating a PHP project can be done by choosing PHP on the web portal or when creating a project using the CLI. Our default PHP configuration sets the memory limit for PHP at 75% of the total servo size. DEPLOYING Deploying a PHP application is done by simply deploying the directory containing your PHP source code. Modulus does not currently support any dependency management for PHP, so dependencies will have to be installed prior to deployment. $ cd path/to/project $ modulus deploy SETTING PHP VERSION Modulus supports PHP versions 5.3.29, 5.4.38, 5.5.22, and 5.6.6. You can change the version of php by deploying an application manifest file (app.json) in the root of your project. You must set the version explicitly to one of the above versions. If no version is specified, or an invalid version is specified, the project will default to 5.4.38. { "engines": { "php": "5.5.22" } } CUSTOM NGINX CONFIGURATION Modulus provides a reasonable base nginx and site configuration that will work for many PHP applications. You can provide your own site-specific nginx configuration by deploying a "sites-enabled" folder with configuration files in the root of your project. All config files located in this folder will be included by nginx. CUSTOM PHP CONFIGURATION Modulus provides a reasonable base php.ini configuration that will work for many PHP applications. If you'd like to override this configuration, you can do so by deploying a file named "php.ini" in the root of your project. CUSTOM PHP-FPM CONFIGURATION Modulus runs php-fpm as the process monitor for php. The default php-fpm.conf can be overridden by deploying a file named "php-fpm.conf" in the root of your project. EXAMPLE: DEPLOYING LARAVEL Get a MySQL database. Modulus does not yet offer MySQL databases, but there are many services that do, including ClearDB , AWS RDS , and Google Cloud SQL . Note: You will no longer have access to the Artisan CLI but you can still run the commands locally with the --env switch like so: php artisan migrate --env=production or use Artisan:call() with a route. For more info see the Laravel documentation . Create a sites-enabled folder in the project root and add your server config like: server { ## # port must be 8080 ## listen 8080; ## # add your url ## server_name someurl.com; ## # add ‘/public’ as required by all Laravel projects ## root /mnt/app/public; index index.html index.php; location / { try_files $uri $uri/ /index.php?$query_string; } location ~ \.php$ { fastcgi_split_path_info ^(.+\.php)(/.+)$; # NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini fastcgi_pass unix:/mnt/home/php-fpm.sock; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_index index.php; include fastcgi_params; } }
Continue reading...
Continue reading...