Is there any way to modify the php.ini file in Mac OSX.. I'm using XAMPP and i need to change the upload-tmp-dir path. Whenever I try to edit and save the file, it shows some error that I am not authorised to do so.
Please help!
You can update using editor in terminal and use sudo command to open it as superuser, see here.
sudo vim php.ini
or
sudo emacs php.ini
Your choice
What if you try to copy php.ini file to your Desktop, make changes, save it, and replace back?
1.open php.ini with superuser
sudo vim php.ini
2.press i to change somthing
3.press Esc and :wq to save and exit
4.restart your web server
Maybe step 4 is the reason "But my uploads are still not working.. ".
Related
I'm troubleshooting a php log file that has expanded way too rapidly and used up a lot of disk space.
What is the best way to clear a log file?
is it a problem to simply delete the log file? And will that log file be recreated as php tries to write to it?
It is entirely safe to just delete the php.log file. It will be auto-created the next time it is needed.
On Linux you can do :
cat /dev/null > /var/logs/php.log
On Mac OS X 10.6 I deleted /var/log/apache2/error_log. Minor panic when it didn't re-appear upon refreshing my page. Just had to restart apache by going through the Sharing settings. Now she's back.
It IS safe to delete the log file by doing the following:
Delete the php.log file altogether.
If on Apache Restart the Server using "service apache2 restart" command
If on NGINX you do not have to restart the server
You can run this simple command from terminal(in WHM) or From SSH terminal.
find -name error_log -type f -exec rm -rf {} \;
This command will find all files with name "error_log" and remove it.
Enjoy.
I've installed "PHP PECL EXTENSION/MODULE ON UBUNTU". At the end, I was asked to add some configuration lines in the a file called php_ini that can be found in this path:
/etc/php5/apache2/php.ini
However, after making my changes, I can't save the file because the file is read-only.
What the appropriate action to save my changes. I don't really why the file is read-only, I don't know if there is some thing I need to do. I'm new in Ubuntu/php
Thanks for helping.
For accessing the system files you need root permission.So you would need to use sudo command.it would be like sudo vim /etc/php5/apache2/php.ini(if u are using vim editor) as user2075215 mentioned in comment.
Use command:
"sudo gedit /etc/php5/apache2/php.ini"
It will open text editor, change your settings and save with ctrl+s and close the editor.
All changes will be saved.
Since I am a beginner in Terminal, I used cd multiple times to get to the location of my php.ini file.
cd etc
cd php
cd 7.0
.
.
.
Then I did
$ sudo xdg-open php.ini
and the file popped up and I am able save edits now.
Does anyone know how to edit the mail setting in the php.ini file by using Vagrant.
so I would ssh in terminal like so:
cd myapp
vagrant ssh
then what>?
Depending on your box, it might be
sudo nano /etc/php5/apache2/php.ini
then adopt you changes and restart with
sudo service apache2 restart
Without knowing what specific setting you want and what you want it changed to, you could try adding a shell script to the end of your Vagrantfile (in the "Local Scripts" area) to do a search and replace on the ini file.
#!/usr/bin/env bash
sed -i.bak s/STRING_TO_REPLACE/STRING_TO_REPLACE_IT_WITH/g /etc/php5/apache2/php.ini
Failing that, you can use ini_set in your project (preferably in a bootstrap) to change mail settings on a per-project basis.
In my case where I'm using scotchbox on vagrant, changing the php.ini file won't reflect changes in phpinfo() function output so I changed /etc/php5/apache2/conf.d/user.ini file which could be a bare file or a file with few lines declaring php error display, I add my configurations here e.g. upload_max_filesize = 64MSave the change and issue sudo service apache2 restart. Viewed the phpinfo page and I can see the updated filesize.
I'm running PHP with MAMP on OSX 10.5.8
So if I want to run a script from console I always need to write
/applications/mamp/bin/php5.3/bin/php path/to/script
which is annoying. Is there a way to change the default path to php so that I can write
php path/to/script
and still uses MAMPs PHP version?
Create a file called .bash_profile on your home directory (if you don't have this file already), and add this to the file:
export PATH=/Applications/mamp/bin/php5.3/bin:$PATH
Then quit and relaunch Terminal.app
Use latest MAMP version of PHP
you need to edit .bash_profile
open -a TextEdit ~/.bash_profile
if you cannot find bash_profile under your home directory then create .bash_profile:
touch ~/.bash_profile
Use latest MAMP version of PHP
PHP_VERSION=`ls /Applications/MAMP/bin/php/ | sort -n | tail -1`
export PATH=/Applications/MAMP/bin/php/${PHP_VERSION}/bin:$PATH
(Run source ~/.bash_profile after making your changes to make sure they take effect.)
source: How to override the path of PHP to use the MAMP path?
The easiest way would be to rewrite the alias. Just copy/paste the cmd bellow into terminal for temporary use or write it into .bash_profile to make it permanent.
For MAMP
$ alias php=/applications/mamp/bin/php5.3/bin/php
For XAMPP
$ alias php=/Applications/XAMPP/bin/php
For AMPPS
$ alias php=/Applications/AMPPS/php-5.6/bin/php
Run php via our new alias
$ php -v
vi ~/.bash_profile
//add
export PATH=/path/to/php/bin:$PATH
source ~/.bash_profile
In addition to bfvarettos great answer: since .bash_profile executes at login, you will need to restart your system for the changes to take effect.
I'm not sure if this is specific to MAMP 3.0 or not but you need to do the following path for MAMP 3.0. Make sure you change the PHP version to the version you are using for your server.
Again this goes in ~/.bash_profile
export PATH=/Applications/MAMP/bin/php/php5.5.10/bin:$PATH
I'm troubleshooting a php log file that has expanded way too rapidly and used up a lot of disk space.
What is the best way to clear a log file?
is it a problem to simply delete the log file? And will that log file be recreated as php tries to write to it?
It is entirely safe to just delete the php.log file. It will be auto-created the next time it is needed.
On Linux you can do :
cat /dev/null > /var/logs/php.log
On Mac OS X 10.6 I deleted /var/log/apache2/error_log. Minor panic when it didn't re-appear upon refreshing my page. Just had to restart apache by going through the Sharing settings. Now she's back.
It IS safe to delete the log file by doing the following:
Delete the php.log file altogether.
If on Apache Restart the Server using "service apache2 restart" command
If on NGINX you do not have to restart the server
You can run this simple command from terminal(in WHM) or From SSH terminal.
find -name error_log -type f -exec rm -rf {} \;
This command will find all files with name "error_log" and remove it.
Enjoy.