The "best" permissions on a file are typically just enough so that the file can be executed, written, or read by anyone who needs to and not one person more.
Describing the permissions as "744" does not tell us who the owner and group of the file are. You also haven't told us how your PHP runs. Does it run when you access it on a web server? If so, then you will need to grant write permissions to whatever user the web server runs as (which may or may not be the owner of the file). Does it run from the command line when you type in a command?