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

almazik's avatar

How do we restart apache...

I've made some changes to my php.ini file and now wondering how to restart apahce service... the command like sudo service apache2 restart says that apache2: unrecognized service

0 likes
13 replies
keevitaja's avatar

Do you have apache installed? Perhaps you are using nginx?

anaxamaxan's avatar

Is this for a box on Forge? Or a local Homestead VM? If either, you're most likely using nginx, not Apache. Forge has a server restart functions available in the bottom-right of the "server details" screen. For Homestead (or any local vagrant VM) you just SSH into the box and do the restart. sudo service nginx restart

4 likes
bashy's avatar
bashy
Best Answer
Level 65

Please let us know which platform you're on. OS X and Linux have different ways of doing it.

Here's some examples

// Debian based releases (could also be httpd and you can also use /etc/init.d/ version)
sudo service apache2 status

// Other Linux ditros (CentOS I know uses this)
sudo /etc/init.d/httpd status

// Red Hat
sudo /sbin/service httpd status

// OS X
sudo apachectl status
2 likes
anaxamaxan's avatar

Oops, I didn't notice that you had this tagged Forge. So, to restart nginx use the menu at bottom right on the Server Details screen. screenshot

bashy's avatar

Actually, if it's on Forge and he's changed php settings, he'll need to restart php5-fpm for changes to take effect.

sudo service php5-fpm restart

Pretty sure it uses FPM otherwise, I'm done with life :)

4 likes
almazik's avatar

Well guys I don't know who I should thank here, appreciate all your help:) Probably I should've start with my direct problem, here it is: Yes, I'm on forge and what I'm trying to do is upload set of images. On my local homestead box it's perfect, but on forge I'm getting this error: 413 Request Entity Too Large. I went ahead and chaged php.ini setting upload_max_filesize then restarted nginx as @anaxamaxan suggested, but it didn't work out. what else should i try?

UPD: just tried

sudo service php5-fpm restart

didn't work out either. Probably wrong setting then

almazik's avatar

post_max_size is already pretty large - 8M. I made upload_max_filesize equal this value. I'm trying to upload only 1.5M

almazik's avatar

Found the solution - I needed to edit /etc/nginx/nginx.conf and into the http context add the following directive

client_max_body_size 100M;
2 likes
bashy's avatar

Yup, that would allow larger uploads. When making a thread, make sure you supply all the information for people to give you better answers :)

fideloper's avatar

@andrew.malinnikov - Just to make sure it's clear, Forge uses:

  • Nginx
  • PHP-FPM

There's no Apache, so restarting Apache will never work :D

Nginx should be reloaded/restarted if any config changes in /etc/nginx are made.

sudo service nginx reload
sudo service nginx restart

PHP-FPM should be reloaded/restarted if any config changes in /etc/php5/fpm are made.

sudo service php5-fpm reload
sudo service php5-fpm restart
bashy's avatar

I think he realised that after posting :)

almazik's avatar

Yep, I did:) Thanks for the hint anyway!

Please or to participate in this conversation.