I got this demo http://www.coolphptools.com/color_extract#demo working in xampp on Windows. But now I want to use it on apache2 in Ubuntu. I installed apache2 and php 7 and put the files into /var/www/html/ But I think php is not working. It only shows the html part but nothing from the php code... Do I need to install something else?

I also ran

a2enmod proxy_fcgi setenvif
a2enconf php7.0-fpm
service apache2 reload

after installing php 7 but it doesn't work.

I thought it might be a problem with the php, because no php from the demo was working.
But when I add a simple php script to get the current time, that is working fine. So now I am even more confused what is causing this issue... Maybe it is a problem with the code? But why did it work fine on xampp?

I also double checked the answer on this PHP script not executing on Apache server post. And everything seems to be correct



sudo apt-get install apache2 php5 libapache2-mod-php5

will install everything you need and will start the apache server with support for PHP.

To verify that the php module is loaded, type:

a2query -m php5

if not enabled, then load with:

sudo a2enmod php5

and restart apache:

sudo service apache2 restart
  • Thanks for the comment but I tried that already :) I found the problem was an image library for php called php-gd – Alexander S. Nov 9 '16 at 11:25
  • can you please share the problem in details – Sukhjinder Singh Nov 9 '16 at 11:26
  • I had to run sudo apt-get install php7.0-gd to implement the gd library which was required for the demo. I didnt notice that because I did not need it on xampp. – Alexander S. Nov 9 '16 at 11:28
  • follow the link it may help you digitalocean.com/community/tutorials/… – Sukhjinder Singh Nov 9 '16 at 11:37

Ok so I didn't notice,


PHP 4.0.2 or higher
GD2 image library

On the website of the demo. I had to run:

sudo apt-get install php7.0-gd

to implement the gd library.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.