I am trying to run a php webapp on eclipse, the mac already comes with PHP but I could not figure out how to get it to work so I decided to install it again using brew. I followed the steps in this tutorial https://aregsar.com/blog/2019/installing-php-on-macos/ and this one as well https://gist.github.com/karlhillx/791babda83495eab6fbf64f8a3270f86. I edited the httpd.conf file countless times and terminal shows the correct PHP version (8.0.2). I also added the java-bridge to the tomcat. When running a simple "Hello World" php file all I get is the code printed in the browser instead of the actual output. I can't figure out what I am missing.
This link contains the .conf files: https://www.dropbox.com/sh/lq8hk120vdqc2f2/AAB88VbjF3Eqr55d55cCsnE2a?dl=0
Any help would be appreciated.
My Answer:
php file from the terminal using the command `php filename.php`, it works perfectly fine. However, when trying to run the php webapp on eclipse, it still does not work.
One possible solution to this issue could be to check the PHP executable path in Eclipse. Make sure that Eclipse is pointing to the correct PHP executable that was installed using brew. You can do this by going to Eclipse preferences, then PHP, and then PHP Executables. Add a new PHP executable and point it to the path where brew installed PHP (usually `/usr/local/bin/php`).
Another thing to check is the PHP interpreter settings in Eclipse. Make sure that the PHP interpreter is set to the correct version that was installed using brew. You can do this by going to Eclipse preferences, then PHP, and then PHP Interpreter. Add a new PHP interpreter and point it to the path where brew installed PHP (usually `/usr/local/Cellar/php/8.0.2/bin/php`).
After making these changes, try running the php webapp again in Eclipse and see if it works. If it still does not work, you may need to restart Eclipse or even your computer to apply the changes.
Rate this post
5 of 5 based on 3937 votesComments