Change php.ini file location to make sendmail() work - is it possible?

Ok, right,so I’ve had a good look through this forum, and from what I can tell, it is impossible to use php to send emails with glitch. I want to change this. So I’ve looked at loads of tutorials online, and figured that the way to do it is to configure the php.ini file.

A summary of what I did

The first thing I did was made a phoinfo.php file with <?php phpinfo(); ?> in it. This brings up all the info about the php configuation. If you go to can-i-make-a-contact-form.glitch.me/phpinfo.php, you’ll see this. I then looked at where it said ‘loaded configuration file’ and copied that path and went to glitch.com/edit/#!/can-i-make-a-contact-form?path=whateverittoldme. It didn’t do anything. I tried multiple variations of it, and so decided to make my own php.ini file. So I did, pasted in the default file for v7.0 (found from the phpinfo) and changed the things that needed to be changed. I reloaded the phpinfo, and it still had the same stuff as before. Read on…

So what I need to do is either access the actual php.ini file, or make php use my php.ini file. Any help would be much appreciated!
Sorry if this is confusing - if you need clarification just ask.

And no, I can’t make a contact form :slight_smile:

A few thoughts:

Try going to the php.ini from the Console instead of using ?path=
That is, open up the console and try

cd /etc/php/7.0/cli
vi php.ini

Make some changes, then save + quit vi by pressing Esc, :x, Return… I don’t know if there are friendlier editors in the Glitch console like nano

My other idea is to avoid php.ini altogether by using ini_set: https://www.php.net/manual/en/function.ini-set.php

Hope it help. Let us know :slight_smile:

2 Likes

Thanks, I’ll try it when I can get to a computer - I’m on mobile at the moment. Thanks for the help!

If you use the lamp-poc project you should be able to find the php.ini file in the root.

Thanks, the ini_set works! I still haven’t managed to make it send mail, but I’ll fiddle around with some values and see what happens…

1 Like

Yes, run nano filename .

Nano is great, I recommend using that.