php.ini is a core file to handle the behavior of PHP and sometimes apache might not pick it and php might not be using and it will create problem.
To resolve this, just see the output of phpinfo first.
Just add the following code snippet in the php file and run it through your server
Then look of configuration file (php.ini) path, by default it would be /etc
If you don’t have the file php.ini in that mentioned directory, just look for related ones like php.ini.default or something and just copy that as php.ini and restart your apache.
There would be a need for this or that reason to serve more than one site from apache. And this is quite possible using configuration inside the apache
First thing first
go to the apache config, by default it should be
And search for
Which, as you can see, is commented. Hence uncomment that by deleting the # infront of it.
The above task will allow us to mess around the httpd-vhosts.conf file that is in the extras directory.
Lets assume we have a site names siteVH which is residing in the directory /www/sitevh
and lets assume we have another site called siteAnother residing in director /www/siteanother
Now the goal is to access those sites independently. So we will create two different virtual hosts for each one and be able to access them independently
CustomLog "/private/var/log/apache2/sitevh.com-access_log" common
Allow from all
Options Indexes FollowSymLinks
And the we will have the same duplicate values for the other one as well.
Then update the /etc/hosts to let know our local “DNS” to know what to do
127.0.0.1 sitevh.com siteanother.com
This shall take care of the whole thing.
One more thing, restart apache
sudo apachectl restart