Asked  7 Months ago    Answers:  5   Viewed   49 times

I followed a guide which used home-brew to install the lastest version of php (5.4.8) on OSX Mountain Lion.

I then followed a guide which showed me how to setup and use the pre-installed apache on OSX.

However when I try running up a base Symfony 2 project I get a bunch of errors relating to missing date.timezone in the php.ini.

However I have this correctly setup the php.ini but doing a quick phpinfo() in the Symfony project shows that its using the old preinstalled version of php (5.3) rather than the new one.

In terminal if I type which php & php -v, It shows the correct new version is being used.

enter image description here

But the phpinfo() shows

enter image description here

enter image description here



Did you follow all the instructions provided in the Caveats?

Run brew info php54 to see them again.

Especially the line:

To enable PHP in Apache add the following to httpd.conf and restart Apache:
LoadModule php5_module /usr/local/Cellar/php54/5.4.8/libexec/apache2/

Wednesday, March 31, 2021
answered 7 Months ago

I have faced similar issue with PHP 5.6 as it was running fine before Mojave upgrade. I did the following to resolve the issue successfully:

  1. Run the command below sudo nano /etc/apache2/httpd.conf

  2. make sure the below modules are uncommented:

    LoadModule authz_core_module libexec/apache2/

    LoadModule authz_host_module libexec/apache2/

    LoadModule userdir_module libexec/apache2/

    LoadModule include_module libexec/apache2/

    LoadModule rewrite_module libexec/apache2/

I have added the missing one in httpd.conf

  1. Check the right php module for you (PHP 5.6 ot 7.x) and load the required module too by adding the line or commenting/uncommenting the lines

    LoadModule php5_module libexec/apache2/


LoadModule php7_module libexec/apache2/

Comment the one not needed by adding "#" to start of line

  1. Run below commands for apapche restart and test a. sudo apachectl restart b. apachectl configtest

Check for any errors there

For PHP 5.6: In case you were having the php 5 with brew already in system before upgarde and the above changes gives error as below "httpd: Syntax error on line 180 of /private/etc/apache2/httpd.conf: Cannot load libexec/apache2/ into server: dlopen(/usr/libexec/apache2/, 10): image not found"

Then search for in the system and if found copy it to "/usr/libexec/apache2/"

In my case command was

sudo cp ./local/Cellar/php@5.6/5.6.25_1/libexec/apache2/ /usr/libexec/apache2/

This all made things working in my system

Wednesday, March 31, 2021
answered 7 Months ago

You need to make sure that the newly installed php command is executed, not the default one.

Add the folder where the correct php binary resides as the first item to the $PATH environment variable.

Saturday, May 29, 2021
answered 5 Months ago

My Apache installation has these two lines in the httpd.conf file:

PHPIniDir "C:/Program Files/PHP"
LoadModule php5_module "C:/Program Files/PHP/php5apache2_2.dll"

Make sure that the directory in these Apache lines is the directory of the version of PHP you want.

You'll have to stop and restart Apache after you make changes to the httpd.conf file.

Saturday, May 29, 2021
answered 5 Months ago

I ran into the same issue and found the following solution in the documentation:

To run your functional tests, the WebTestCase class bootstraps the kernel of your application. In most cases, this happens automatically. However, if your kernel is in a non-standard directory, you'll need to modify your phpunit.xml.dist file to set the KERNEL_DIR environment variable to the directory of your kernel:

    <!-- ... -->
        <server name="KERNEL_DIR" value="/path/to/your/app/" />
    <!-- ... -->

So check your phpunit.xml.dist configuration file and try to add the absolute path to your app-directory.

Hope it helps.

Friday, July 30, 2021
Bálint Molnár
answered 3 Months ago
Only authorized users can answer the question. Please sign in first, or register a free account.
Not the answer you're looking for? Browse other questions tagged :