PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0
Showing posts with label local. Show all posts
Showing posts with label local. Show all posts

Wednesday, October 19, 2022

[FIXED] How can I log into an existing wordpress site locally on mac

 October 19, 2022     admin, bitnami, local, wordpress, wordpress-theming     No comments   

Issue

I already have a live existing wordpress site. I am trying to install wordpress locally for mac. I want to make edits of my site, but don't want my live site to look under construction. I have tried Bitnami and Local, but only see the option to create a new site and dont see a login to existing option. I appreciate any help, thank you.


Solution

Bitnami Engineer here,

You can also use the All in One WP Migration Plugin to migrate the data of your live site to the development one (this one can be the one we offer in our site: https://bitnami.com/stack/wordpress/installer). Once you test your changes, you can apply them in the live site.

You can find more information about it in our documentation

https://docs.bitnami.com/installer/how-to/migrate-wordpress/



Answered By - Jota Martos
Answer Checked By - Timothy Miller (PHPFixing Admin)
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg

Friday, August 26, 2022

[FIXED] How to run a WordPress PHP in local

 August 26, 2022     html, local, php, wordpress     No comments   

Issue

My friend gave me her WordPress website to run in localhost, but I never did it. I had installed the xampp server, but her website doesn't show in my local.

All she gave me was a 'wp-content' folder, a '.htacess' file and a 'site.php' file, which has HTML and PHP content inside of it. I just want to run it in my local so I can edit it for her.


Solution

You're missing a lot of files and folders that are required to run wordpress. Also, site.php is not a core wordpress file.

You can download the official wordpress zip from here and compare it with that you have.



Answered By - Vinay Jain
Answer Checked By - Dawn Plyler (PHPFixing Volunteer)
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg

Sunday, August 21, 2022

[FIXED] Why are my custom process.env not working within dotenv?

 August 21, 2022     dotenv, environment-variables, local, node.js     No comments   

Issue

Learning that it is a bad practice to include API secret keys I've done some research and trying to learn how to create custom process.env.

After reading:

  • Node.js Everywhere with Environment Variables!
  • How to set NODE_ENV to production/development in OS X
  • How to set process.env from the file in NodeJS?
  • dotenv file is not loading environment variables

I'm trying to set an env file locally based on process.env.NODE_ENV. The application would be hosted on Heroku and in my .gitignore I have dev.env but when I try to use dotenv locally I'm getting an undefined. I have set the environment locally with export NODE_ENV=development in my terminal. When I run the command npm start or nodemon both return undefined but in env.js I get Testing for: development, example:

nodemon

[nodemon] 1.19.1
[nodemon] to restart at any time, enter `rs`
[nodemon] watching: *.*
[nodemon] starting `node app.js`
Testing for: development
undefined

Here is what I have:

app.js:

const keys = require('./config/env')
return console.log(process.env.PORT)

config/env.js:

const env = process.env.NODE_ENV
console.log(`Testing for: ${env}`)
try {
  switch(env) {
    case 'undefined':
      Error('Environment undefined, if local in terminal: export NODE_ENV=development')
      break
    case 'development':
      require('dotenv').config({
        path: './dev.env'
      })
      break
    case 'production':
      require('dotenv').config({
        path: './prod.env'
      })
      break
    default:
      Error('Unrecognized Environment')
  }  
} catch (err) {
  Error('Error trying to run file')
}

config/dev.env:

## Port number to run Application
PORT=4321

but in app.js when I test with return console.log(process.env.PORT) or return console.log(keys.PORT) they both log undefined, why? I seem to be doing something wrong in env.js when using dotenv.

To clarify I'm not even pushing to Heroku yet and prod.env will be validation. If there is a better approach please educate me.


Solution

I've figured where I was going wrong after re-reading the documentation regarding path, example:

require('dotenv').config({ path: '/full/custom/path/to/your/env/vars' })

After changing:

case 'development':
  require('dotenv').config({
    path: './dev.env'
  })
  break

to:

case 'development':
  require('dotenv').config({
    path: `${__dirname}/dev.env`
  })
  break

it works. So my error was a scope issue. No need to set const keys so just using require('./config/env') I can access any custom processes, example:

process.env.CUSTOM

or in this case it would be:

process.env.PORT

from app.js



Answered By - DᴀʀᴛʜVᴀᴅᴇʀ
Answer Checked By - Cary Denson (PHPFixing Admin)
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg

Friday, August 5, 2022

[FIXED] How to add texts messages to exceptions defined by local classes?

 August 05, 2022     abap, class, exception, local     No comments   

Issue

I want to raise an exception of a local type, and pass it in the constructor a *text.

This *text is what i want to be returned by calling the get_longtext method, later, when i catch the exception.

Of course i can add an attribute to my class, and redefine the method. It seems to me like there should however be an easier way (like there is in the java-like languages, where you just "have" that).

There's the TEXTID parameter in the inherited constructor for the exceptions. That however points to the "texts" defined as class properties... but that's for global classes.

So is there any way for me to make use of the already existing constructor in an elegant way? Or must I simply do it all by hand?


Solution

If you don't want to uses global classes (as recommended), you can try to implement the interface IF_T100_MESSAGE in your local class. First maintain the error messages in any message class via SE91, then define text ids in your local exception class of type SCX_T100KEY. Implement the exception class methods to use additional attributes for the placeholders in your message texts (if necessary).

Check IF_T100_MESSAGE and CL_MESSAGE_HELPER for details. To get example code, create a global exception class and add the interface IF_T100_MESSAGE and check how the methods are implemented.



Answered By - Hans Hohenfeld
Answer Checked By - Senaida (PHPFixing Volunteer)
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg

Friday, February 18, 2022

[FIXED] NodeJS and MAMP running on local machine. Is it possible?

 February 18, 2022     local, macos, mamp, node.js     No comments   

Issue

Is it possible to have NodeJS and MAMP running together on the same machine? If so how would i achieve this?

Note: I can run them separately just not together. I assume its down to my NodeJS using the "localhost" as well as MAMP.


Solution

You can setup Proxy and a host.

for example create node01.example.com in Hosts. Then Go to Advanced and enter the following in "Customized virtual host general settings"

ServerAlias node01.example.com

 <Location />

  ProxyPass http://127.0.0.1:3000/

ProxyPassReverse http://127.0.0.1:3000/

</Location>

when you visit node01.example.com you'd pass through MAMP and go to your node ;)



Answered By - Kerim Incedayi
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Older Posts Home
View mobile version

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
All Comments
Atom
All Comments

Copyright © PHPFixing