How to reconfigure apache httpd.conf file for local LAMP environment? - php

I was attempting to set-up my local environment for LAMP on my desktop with Guy Nathan's Installing LAMP stack on OSX Mavericks with Homebrew updated guide. Since I'm experienced with RoR, I proceeded with homebrews but along the way, evidently, I misconfigured the /usr/local/etc/apache2/2.2/httpd.conf file because whenever I try to start the apache server with sudo apachectl start or test with sudo apachectl configtest, the following error is invariably returned:
httpd: Syntax error on line 482 of /usr/local/etc/apache2/2.2/httpd.conf: Could not open configuration file /Sites/httpd-vhosts.conf: No such file or directory
Due to the length of the 'http.conf' file, I've created a gist of my 'httpd.conf file' for review.
At this point, I would just like to reset my 'httpd.conf' file, or whatever is necessary so I can properly configure my local environment for LAMP. I've tried other solutions involving a reversion of /private/etc/apache2/httpd.conf.pre-update but was unable to effect. Thank you.

It is failing to start because the httpd.conf file is specifying an include of /Sites/httpd-vhosts.conf which doesn't exist.
Either comment out line 482 by putting a # at the beginning of the line, or create an empty /Sites/httpd-vhosts.conf file so it can be included. If its empty it won't have any effect.
Here are some examples of what would typically go in that file.

Related

SQLAnywhere PHP extension errors on Apache restart

I have the SQLAnywhere PHP extension installed and it's working fine, right up until Apache restarts.
After Apache has restarted, any attempt to access any website on the server generates the following error in the Apache error log and throws a 500 internal server error on the page:
AH01215: PHP Warning: request_startup() for sqlanywhere module failed in Unknown on line 0: /usr/local/cpanel/cgi-sys/ea-php56
To resolve it, I can explicitly stop and start Apache, but restarting Apache (apachectl restart) doesn't.
This is generally fine until an automated process (such as a cPanel update) causes Apache to restart.
The SQLAnywhere PHP extension was configured as follows:
Install the SQLAnywhere client
Download the PHP extension to the extensions directory
Add LD_LIBRARY_PATH=[sqlanywhere/lib64] to /etc/environment
Log out and back in for the LD_LIBRARY_PATH to take effect
Add the extension to the php.ini (or sqlanywhere.ini in php.d folder)
Stop then start Apache
My current thinking for a workaround is to modify the cPanel update script to perform an Apache restart by explicitly doing a stop then a start as this would cover the immediate issue, but I'm hoping that somebody might know of an actual fix for this to avoid any other automated restarts causing problems.
The stack I'm running is:
CentOS Linux release 7.3.1611 (Core)
cPanel 60.0 (build 28)
Apache/2.4.23 (cPanel)
PHP 5.6 (using cPanel's MultiPHP and EasyApache4)
SQLAnywhere12 Client
Thanks in advance for any suggestions!

Apache can't load mod-php5.so

I've suddenly started having a problem with Apache2 and PHP after a recent update. Apache won't start, giving me the following error:
apache2: Syntax error on line 227 of /etc/apache2/apache2.conf: Cannot load mods-enabled/mod-php5.so into server: /etc/apache2/mods-enabled/mod-php5.so: cannot open shared object file: No such file or directory
I've followed advice on a couple sites, leading me to do the following things:
In apache2.conf:
Changed /etc/apache2/modules to /etc/apache2/mods-enabled
Changing mod-php5.so to mod-php55.sp
Reinstall libapache2-mod-php5
ldconfig
whereis mod-php5.so (no results, also tried mod-php55.so and mod-php.so)
WHere is mod-php*.so located, and why is Apache suddenly not finding it?
EDIT: Sorry, forgot to say I'm running Linux Mint 17 x64.

XAMPP Apache Won't Start after PHP Upgrade

Apache won't start on Mac with XAMPP. I tried updating PHP from 5.5.6 to PHP 5.6.8, and since that update XAMPP wouldn't start Apache. I tried completely re-installing XAMPP, but same issue.
Help would be appreciated, I'm more than happy to post any information that is necessary, not sure where to start. I've done a lot of looking around and haven't been able to find anything that points me in the right direction - I checked the Apache error_logs and there aren't any.
Try this -
Solution#1
This solution worked perfectly fine for me..
1) Close XAMPP control
2) Open Activity Monitor(Launchpad->Other->Activity Monitor)
3) Select filter for All processes (default is My processes)
4) In fulltext search type: httpd
5) Kill all httpd items
6) Relaunch XAMPP control and launch apache again
OR, Solution#2
sudo apachectl stop
This command kills Apache server that was pre-installed on MAC OS X.
OR, Solution#3
sudo launchctl unload -w /System/Library/LaunchDaemons/org.apache.httpd.plist
This will disable OSX's built-in Apache server and allows XAMPP to start on 80.
Now once Apache starts successfully modify the .htaccess file
Apache needs to be configured to recognize index.php as an index file. While adding 'DirectoryIndex index.php' to a .htaccess file may work,
NOTE:
In general, you should never use .htaccess files
This is quoted from http://httpd.apache.org/docs/1.3/howto/htaccess.html
Although this refers to an older version of apache, I believe the principle still applies.
Adding the following to your httpd.conf (if you have access to it) is considered better form, causes less server overhead and has the exact same effect:
<Directory /myapp>
DirectoryIndex index.php
</Directory>
I've updated PHP to 8.0 in xampp by renaming old PHP folder to PHP_7.4
and new pasted new php8 folder as php folder, it gave me same error,
SOLUTION
Step1: backup old php folder,
Step2: Paste php8 files in to old PHP folder and overwrite existing files,
Done: Restart Apache it should start

ionCube installation :: missing zend_extension CentOs

I am in middle of ionCube installation but php configuration is missing zend_extension for ionCube but not specify what is exactly
I am working on CentOs
All well Thanks:)
There were few things I have missed
Select the correct bit release
Match the Loader with your PHP version, e.g. for PHP 5.3, ioncube_loader_lin_5.3.so (extensions are inside the folder)
Add 'zend_extension = /usr/local/ioncube/ioncube_loader_lin_5.3.so' to php.ini
Restart the server
There are 2 parts to the solution that worked for me:
symlink the 00-ioncube.ini file into the conf.d directory from the mods-available directory. Do not simply copy the file into the conf.d as the loader-wizard suggests.
Restart the fastcgi daemon off and on as well as the apache daemon
See my blog post for more details.
I had the exact same problem with installing on Ubuntu. Ubuntu wants a soft link from /etc/php5/apache2/conf.d/20-ioncube.ini to /etc/php5/mods-available/20-ioncube.ini. I tried THAT after following the directions given and apache restart failed with this error: "PHP Fatal error: [ionCube Loader] The Loader must appear as the first entry in the php.ini file in Unknown on line 0" in the error log /var/log/apache2/error.log
The solution that worked for me was to delete the soft link and to add the line from /etc/php5/mods-available/20-ioncube.ini ("zend_extension=/usr/lib/php5/20121212/ioncube_loader_lin_5.5.so") to /etc/php5/apache2/php.ini
Possibly of note, I removed spaces on either side of the equals sign.
Apache restarted successfully and clicking the test link in the loader script page resulted in a success message as did subsequent script execution in my development environment dependent upon ioncube.
Actually ioncube needs its own ini files in php.d directory. Ioncube read its own file with the name of 20-ioncube.ini file.
So to do this we need to create vi /etc/php.d/20-ioncube.ini and add text: "zend_extension = /usr/lib/php/modules/ioncube_loader_lin_5.3.so" in it. Now reload php-fpm and browser. Ioncube will find zend framework now.
You can try to execute my install ioncube script in my gist, install_ioncube.sh
Or manual install follow the official wizard in other script
# run-loader-wizard.sh
curl -O https://www.ioncube.com/loader-wizard/loader-wizard.tgz
tar zxvf loader-wizard.tgz
cd ./ioncube
php -S localhost:8000
# open http://localhost:8000/loader-wizard.php

Issue loading php_mysql.dll extension

I have been trying for a very long time to try and get mySql set up with php. The php install definitely works, and when I call phpInfo() I can see that my extension directory is being set.
When I uncomment the lines:
extension=php_mysql.dll
extension=php_mysqli.dll
I get an error when I try to restart my apache web service:
Windows could not start the Apache2.2 service on Local Computer.
Error 1067: The process terminated unexpectedly.
I am not sure what to do, I have search for answers almost everywhere and have not found a solution. Any thoughts?
Here is what I have setup:
Apache 2.2,
PHP 5.2.17 (V6),
MySql 5.5
extension_dir = "C:\php\ext" (I have tried just "ext" and adding trailing "\" and no luck)
I have C:/php set up as an environment variable - as I stated earlier, php is working but I just can't get MySql setup.
I double checked all of those, but those did not fix it.
FIXED IT:
I ended up deleting my install of php and reinstalling the thread safe V6 version and it fixed my problem.
Thanks for the advice guys.
Try copying your current libmysql.dll to C:\Windows\system32 (you should find it in the php root folder). This is quite often the reason for failing php/MySql installations on Windows.
Make sure your Path environmental variable has C:\php\ext in it. If you add it in, reboot.
Try starting Apache from the command line to get the specific error message:
httpd -k start
...and check Apache's error.log file.
Do a system search for php_mysql.dll and php_mysqli.dll. If you have either one in your C:\Windows or C:\Windows\system32 directory, delete those files.

Categories