I have set up a MAMP server on my local computer.
The server runs fine, no problems, but I need to install the mcrypt extension on PHP as I need to install Laravel.
I've been following this tutorial:
http://coolestguidesontheplanet.com/install-mcrypt-php-mac-osx-10-9-mavericks-development-server/
I have an issue with the last step. When I create a new php.ini file using the following Terminal command, PHP refuses to run at all.
sudo cp /etc/php.ini.default /etc/php.ini
Basically with no php.ini file in the etc/ folder, the PHP works fine (PHP info pages load, sites using PHP run fine), but when it's in place, no PHP works and loading a PHP info page returns a blank white browser window.
Am I missing something?
OK I managed to figure out the issue, here's the solution for anyone stumbling on this in the future.
short_open_tags was disabled in the php.ini file. I simply enabled this, saved the file to the /etc folder and rebooted the Apache server and it works great now. I needed to modify the php.ini file again to add the mycrypt extension but now works great.
Related
I think I did quite a good job on installing PDFlib on a system (Ubuntu 18.04) but something's not totally right yet. What I did so far:
Followed the instructions here: https://www.pdflib.com/fileadmin/pdflib/pdf/support/PDFlib-in-PHP-HowTo.pdf
Downloaded the correct php_pdflib.so file and placed it in the extension directory I got through phpinfo()
Added extension=php_pdflib.so in my php.ini
Ran a sudo systemctl restart apache2 to restart Apache and reload extensions
Checked with php -i | grep PDF whether the binary was loaded or not, result seems positive
PDFlib
PDFlib Support => enabled
PDFlib GmbH Binary-Version => 9.2.0
Now, when I run phpinfo(); from the web side through a file, there is no mention of PDFlib at all. When I run it through CLI, everything seems to be okay.
I also tried creating a new PDFlib() instance through CLI and web. CLI works, web doesn't.
Did I miss something in the install process?
I also tried creating a new PDFlib() instance through CLI and web. CLI works, web doesn't.
this is a typical situation. The PHP CLI and the PHP within the web server could have different configuration. So please check the extension_dir as well which the php.ini which was loaded in your web server phpinfo() output. Then you have do the the same configuration. Please check as well the PHP/Webserver log file for any error messages. Maybe it might be NTS/TS (threading) issue as well, but this will be mentioned in the error message.
Being not a good engineer today, I did several things at once, so I can't tell what exactly worked out in the end. Will write down my steps nevertheless, as it works now.
I double checked the configuration file paths and files through php -i and a phpinfo(); to see the differences between CLI and web frontend.
I removed the extension=php_pdflib from both php.ini files
I moved the php_pdflib.so from the extension directory one level up, it now lives in /usr/lib/php directly
I also renamed it to phplib.so (but that was more to break things on purpose and see what happens
I created a 30-pdflib.ini file in /etc/php/7.3/fpm/conf.d and wrote only extension=/usr/lib/php/pdflib.so in it
Added that line to /etc/php/7.3/cli/php.ini to see if there's a difference
I tried restarting Apache2 several times, but phpinfo() did not show any changes for the loaded configuration files or modules
I did a sudo reboot
Checked again and now PDFlib is loaded for CLI as well as for web
So, not sure if a hard reboot really fixed this, but it seems to me like that. Maybe this helps someone else.
I have wamp install on my computer and IIS. All the websites are running well but then any command I type using php is not working :
php -v
php composer install
I would say it is the path variable (I am on windows) but the path is set correctly and it would generate an error of not finding php command. When I run those command I simply don't get any result.
What might be the problem, I am still searching but have not found any clue.
php -h
: return result with all the help information but php -a does nothing too.
After doing some research I found that this problem happens when I activate an extension by remove ; in php.ini whenever I leave php.ini without activating any extension everything works.
Check if the path contains php, also using the cd command, move to the location of the file and run the command you want to execute. If it works, you're sure the problem is the windows path.
I have fixed the issue. To see if the problem was with php.ini, I replaced the content of my php.ini with the php.ini-production file which made the php function well but almost all the extensions were desactivated.
As I was analysing I noticed wamp had many php extensions activated but in my php.ini residing under C:\wamp64\bin\php\php7.3.5 none of these extensions were activated following the path the file used by wamp I found it was using the phpForApache.ini via a link php.ini file inside C:\wamp64\bin\apache\apache2.4.39\bin
Since the wamp php configuration was working well, I just copied the content of that phpFOrApache.ini content in my php.ini after saving ... everything started working.
I'm getting a fatal error on my require_once('directory/file.php'), "failed opening required...". I know the required file is in my php includes folder at c:\PHP_Includes\directory\file.php. When I look at phpinfo() I see the correct include_path: ".;c:\PHP_Includes"
But in the command line error it says include_path='.;C:\php\pear;C\Projects\project1\classes'
Any idea why the path seems to be different when running command line script?
The problem is related to the fact that WampServer has a multitude of php ini files. Make sure to keep them all in sync with the correct settings to avoid problems when one is used instead of the other.
Very useful info from http://forum.wampserver.com/read.php?2,72804:
There is actually 3 php.ini files in WampServer
This is how they are used...
C:\Wamp\bin\php\phpX.X.X\php.ini This is only used by wampserver and php cli exe. WampServer's menu is built using php and this is the
config file that is used. It is also used if you are using php through
the command line interface. You generally never need to edit this
file.
C:\Wamp\bin\php\phpX.X.X\phpforapache.ini This is a copy of the php.ini file used for your websites. When this version of php is being
used this file is copied into the apache bin folder. If you change
version of php the apache\bin\php.ini is then emptied and the
phpforapache.ini of the new version of php is loaded into whichever
version of apache is loaded.
C:\Wamp\bin\apache\apacheX.X.X\bin\php.ini This is the actual php.ini that is loaded for your websites. provided that this is the
version of apache being used. This is copied from the relevant active
php folder( phpforapache.ini).
This may seem a little confusing but it is nessecary for WampServer's
ability to change version of apache and php easily. The best thing to
remember is..
If you want to manually edit your php.ini file for websites then
always use the wampserver menu to open it . >> left click the
WampServer icon > php > php.ini
If you want to manually edit your php.ini file for command line then
open php.ini in the current php folder.
I'm running MAMP Pro v2.1.1 on OSX 10.8.5
I like to modify a couple settings for phpMyAdmin by modifying the settings in /Library/Application Support/absolute/MAMP PRO/phpMyAdmin/config.inc.php
This works just fine, but every time I restart MAMP, the settings revert back to the defaults. It's really annoying.
I know that the php.ini file and other files are meant to be edited with MAMP's built-in editor. But there does not appear to be an option for phpMyAdmin.
Actually I had the same issue... Pretty annoying but I found out after emailing them that the file at /Library/Application Support/absolute/MAMP PRO/phpMyAdmin/config.inc.php is basically a temporary placeholder for your settings, inasmuch as whenever you start up MAMP the contents of the file at /Applications/MAMP/bin/phpMyAdmin/config.inc.php is read and copied into it, overriding whatever's already there.
That said, here's what to do:
Stop all servers and quit MAMP (completely)
Make your changes to the file located at /Applications/MAMP/bin/phpMyAdmin/config.inc.php
Open MAMP again and start all servers
The settings from the file you just edited should now be copied into the one that's actually read by MAMP and should take effect immediately.
For instance, I prefer to not enable the AJAX feature, so I did this:
Shut down the servers
Closed MAMP (entirely)
Opened the file /Applications/MAMP/bin/phpMyAdmin/config.inc.php
Added $cfg['AjaxEnable'] = false; to the file
Saved the file
Reopened MAMP
Started the servers
... and all was well.
Its a very late answer but problem still persists in OS Sierra. So, this is what worked for me -
You can change the owner of phpMyAdmin by using this command -
sudo chown -R _www:_www /Library/WebServer/Documents/phpMyAdmin
Replace the directory path of phpMyAdmin in case you installed it somewhere else.
When I modify the php.ini document found in
Applications/MAMP/conf/php5/php.ini
The changes are not reflected in the php info page in the MAMP interface
WHY?
You need to restart MAMP (Or indeed any Apache Server) for changes in php.ini to take effect. Restart MAMP using the GUI.
If you are still experiencing no changes, it's possible you are editing the wrong php.ini file. In MAMP, each php version has it's own php.ini file.
To make utterly sure you are editing the right php.ini file, use the following steps:
Create a new .php file in your favourite text editor.
Type
<?php phpinfo(); ?>
and save it in MAMP's htdocs directory.
Save it as index.php
Make sure MAMP is running!
Start Safari, or any browser, and type "localhost:8888" into your
URL bar.
You should see a purple table filled with information about your
apache server.
The 6th row should be titled "Configuration File (php.ini)", and on
the right of this, a path should be displayed to the php.ini file apache is
currently using. It should look like this:
"/Applications/MAMP/bin/php/php5.4.4/conf"
Now, either use Finder to look browse to this location and edit the
.ini file with Text Edit, or use Terminal.
If you want to use Terminal, open a new window and type the
following: 'cd (and then copy and paste the path you gained from
step 6)'. It should look like something like this: 'cd
/Applications/MAMP/bin/php/php5.4.4/conf'
Now type 'ls'
Typing ls will show you the files within the 'conf' directory. The
correct php.ini file should be displayed amongst other files such as 'pear.conf'. If you can
see 'php.ini', we're nearly there. If not, you've gone wrong somewhere, so
read over the previous steps.
Now type 'sudo nano
/Applications/MAMP/bin/php/php5.4.4/conf/php.ini'
And give Terminal your password when it asks for it
The php.ini file will be opened in
Terminal's integrated text-editor, nano. Edit it, and save it using
Nano.
Simply quit terminal. 15) Restart Apache using MAMP's GUI 16)
Browse to localhost:8888 in your favourite browser. Your changes
should be reflected in the configuration screen.
I understand this instructions may be hard to follow, but just contact me if you want to use team viewer or something to get this working! Good luck
Possible answers:
You forgot to restart the Apache
webserver after the change
PHP uses a
php.ini from a different location (Check
the PHPIniDir setting in your Apache
config).
It seems that there are 2 php.ini files in the MAMP installation. The one that seems to be parsed in my case is not in the config/ folder but in the bin/php/php5.3.14/conf/php.ini