Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

APPLE199's avatar

How to deploy Laravel 5.1 to CentOS VPS?

Hey guys. I have been searching for 4 hours on how to deploy my site.

I moved from codeigniter so it's been a good journey for me. I have no idea how to deploy my site to my VPS that is installed in CentOS. I created a cPanel just for this to test out.

I searched for tutorials on YouTube but they're all based on Laravel 4.0 I saw Jeff's video on deploying but it's to some other company. I have looked all over, but they're all showing you how to deploy using DigitalOcean, forge, etc.

I just want to deploy it to my WHS->cPanel which is running on CentOS.

How can I do this?

Thanks.

When I simply upload my entire application folder in my public_html folder, and visit mysite.com/public, I get a blank page and when I check my error log, I see this: "[19-Dec-2015 21:14:59 America/Detroit] PHP Parse error: syntax error, unexpected 'class' (T_CLASS), expecting identifier (T_STRING) or variable (T_VARIABLE) or '{' or '$' in /home/saver/public_html/blog/public/index.php on line 50"

I have tried doing this with a fresh installation of Laravel but same issue.

How the heck do I do this?

thanks guys :)

0 likes
2 replies
T2thec's avatar

What do you get if you visit /blog/public ? Looking at the error, that is where the root of your site is.

You should also look to change the config of WHM to serve your site from the public folder inside you app. That a, if a hacker gets on to your server, they won't have access to your laravel app itself.

I resume WHM is still Apache? What version of PHP?

ohffs's avatar
ohffs
Best Answer
Level 50

CentOS defaults to an older release of PHP - you need to enable the Software Collections to install a newer one (at least, that's the 'official' way). For CentOS 7 that would be something like :

yum -y install https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm https://www.softwarecollections.org/en/scls/rhscl/httpd24/epel-7-x86_64/download/rhscl-httpd24-epel-7-x86_64.noarch.rpm https://www.softwarecollections.org/en/scls/rhscl/rh-php56/epel-7-x86_64/download/rhscl-rh-php56-epel-7-x86_64.noarch.rpm
yum -y install mariadb-server mariadb rh-php56 rh-php56-php-mysqlnd rh-php56-php-mbstring rh-php56-php httpd24-httpd vim rh-php56-php-ldap wget
systemctl enable httpd24-httpd.service
systemctl enable mariadb.service
systemctl disable firewalld
systemctl stop firewalld
systemctl start mariadb.service
systemctl start httpd24-httpd.service

And if you want to use php56 from a shell/commandline you'd ssh in and run scl enable rh-php56 bash .

Please or to participate in this conversation.